-
-
Notifications
You must be signed in to change notification settings - Fork 710
feat: Add logging to file #2781
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
base: main
Are you sure you want to change the base?
Conversation
This uses tracing appender and combines with the default stdout writer that comes from `fmt::layer`. Signed-off-by: Taylor Thomas <taylor@oftaylor.com>
tokio::fs::create_dir_all(&log_dir) | ||
.await | ||
.wrap_err("could not create log directory")?; | ||
let appender = RollingFileAppender::builder() |
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.
This seemed like a decent idea so the log wouldn't grow forever, but we can also just do a plain file as well
crates/atuin/src/command/client.rs
Outdated
let appender = RollingFileAppender::builder() | ||
.filename_prefix("atuin.log") | ||
.rotation(Rotation::DAILY) | ||
.max_log_files(7) |
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 would probably make this configurable if we want to keep the rotating appender around. If we do, should this just be an env var or also exposed in settings?
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 an env var for now just in case. Easy enough to pop off or modify depending on feedback!
In draft so I can get some feedback on the comments above. If there was a different idea in mind, please let me know. This wasn't too difficult so easy enough to throw away and take another approach |
This configures the total number of days of logs that should be kept Signed-off-by: Taylor Thomas <taylor@oftaylor.com>
This uses tracing appender and combines with the default stdout writer that comes from
fmt::layer
.Closes #87
Checks