-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
Support date/time in log file name #374
base: main
Are you sure you want to change the base?
Conversation
FYI @Creative-Difficulty @TuEmb I'll help you guys prep this PR for merging. However, it looks like in working your change you've removed functionality from the library. Can you please rework this maintain the original functionality? |
Thanks for your reply. Could you tell me which part do I need to rework ? I really want to do that features, because I used Is this |
@TuEmb The previous solution also handles environment variables as part of the path, unless I'm missing it, I don't see that in the new solution. |
Please also update the documentation. Most is generated by rustdoc but we also have some manual markdown as well in the docs directory. |
@bconn98, I have updated new commits to keep environment variable as part of the path and updated documentation for date & time format path. Please help me review those changes |
Is this feature still being worked on? |
@bconn98 Thank you for your quick response. Unfortunately, setting up proper logging is literally the very first thing I do when I start a new language, so I think immediately contributing to an established project without ever having written anything in Rust is above my ability... For the time being, I will probably set up a custom appender, but I will come back to this in a couple of months should I feel confident enough to meaningfully contribute. |
@bconn98 sorry, I assumed that you accepted with my implementation using chrono pattern. Could you help me review again with my latest commits ? |
My previous review comment has not been completed. We need a pattern around the date '{}' similar to how the environment variables works. This will allow for you to find it regardless of where it falls in the pattern string. |
I added a pattern with |
@TuEmb Sorry for the question, but is there a reason for |
@TuEmb I'll take a look this evening. @9-FS The reason for the requested change is that we support different patterns when generating log file names. Historically, we support either environment variables using ENV{} or iteration via {}. So the new addition of date/time needs a similarly unique key for us to search for that would not negatively impact the existing options and allows for the pattern to exist anywhere in the string without concern for ordering. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much better! Just a few small comments @TuEmb
} | ||
} | ||
PathBuf::from(date_time_path) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add some unit tests for this function? It would be great to just verify some edgecases and verify this is working as intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added unit test for this function:
- valid
$TIME{}
format - invalid
$TIME{}
format - no
$TIME{}
format - multiple
$TIME{}
in the path
- Seperate TIME and ENV pattern - Support multiple placeholders - Add unit tests for: valid, invalid and multiple placeholders
It’s blocked by #367 |
reading this thread made me sad |
This is blocked by the pr to resolve chrono deprecations.
|
Hi @estk,
As #242. I want to create a PR to apply date/time in log file name.
The path in file appender will be:
It has the same format with
chrono::datetime