Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate datetime components in logfile names with punctuation #1445

Merged
merged 2 commits into from
May 24, 2024

Conversation

jwodder
Copy link
Member

@jwodder jwodder commented May 23, 2024

The logfile names are currently too hard to read; the names need to be broken up more.

@jwodder jwodder added DX Developer eXperience patch Increment the patch version when merged labels May 23, 2024
@jwodder jwodder requested a review from yarikoptic May 23, 2024 12:36
Copy link

codecov bot commented May 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.62%. Comparing base (722f1b6) to head (a847a9b).
Report is 54 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1445   +/-   ##
=======================================
  Coverage   88.61%   88.62%           
=======================================
  Files          77       77           
  Lines       10563    10563           
=======================================
+ Hits         9360     9361    +1     
+ Misses       1203     1202    -1     
Flag Coverage Δ
unittests 88.62% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -99,7 +99,7 @@ def main(ctx, log_level, pdb=False):

logdir = platformdirs.user_log_dir("dandi-cli", "dandi")
logfile = os.path.join(
logdir, f"{datetime.now(timezone.utc):%Y%m%d%H%M%SZ}-{os.getpid()}.log"
logdir, f"{datetime.now(timezone.utc):%Y.%m.%d.%H.%M.%SZ}-{os.getpid()}.log"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so instead of

20240503020100Z-1853999.log

it would become

2024.05.03.02.01.00Z-1853999.log

which also doesn't help in separating the date from time - IMHO the most important one for readability. What about middle ground of just

Suggested change
logdir, f"{datetime.now(timezone.utc):%Y.%m.%d.%H.%M.%SZ}-{os.getpid()}.log"
logdir, f"{datetime.now(timezone.utc):%Y%m%d.%H%M%SZ}-{os.getpid()}.log"

ie.

20240503.020100Z-1853999.log

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yarikoptic I think just separating the individual components is the most important part for readability. How about keeping the component separators but changing the date-time separator to a hyphen, e.g., 2024.05.03-02.01.00Z-1853999.log?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks better! one more possible iteration: in duct (attn @asmacdo ) ATM we take iso8601 but replacing : with - as well to avoid : in filename (but also lacking Z for timezone depiction)... so it then could be 2024-05-03T02-01-00Z-1853999.log. Frankly using . makes it cleaner. So may be let's go with this last iteration and consider doing the same in duct @asmacdo

@jwodder jwodder changed the title Separate time components in logfile names with periods Separate datetime components in logfile names with punctuation May 23, 2024
@jwodder
Copy link
Member Author

jwodder commented May 24, 2024

@yarikoptic Can this be merged now?

@yarikoptic yarikoptic merged commit 3f0318c into master May 24, 2024
28 checks passed
@yarikoptic yarikoptic deleted the split-logfile-names branch May 24, 2024 13:12
Copy link

🚀 PR was released in 0.62.2 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Developer eXperience patch Increment the patch version when merged released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants