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

Log to stdout #30

Closed
tkellogg opened this issue Jan 4, 2022 · 5 comments
Closed

Log to stdout #30

tkellogg opened this issue Jan 4, 2022 · 5 comments
Labels
good first issue Good for newcomers

Comments

@tkellogg
Copy link
Owner

tkellogg commented Jan 4, 2022

Last night I made a change to log JSON to ~/.config/dura/logs/. However, writing to stdout has a lot of advantages when running with other tools, like systemd.

  • Print to stdout by default
  • Print to file if --log-file is specified
@pdogr
Copy link
Contributor

pdogr commented Jan 5, 2022

Does it make sense to use a pre-existing logger like slog?

@tkellogg
Copy link
Owner Author

tkellogg commented Jan 5, 2022

@plaxi0s besides being an amazing name for a logging library, it does suggest tracing instead. Do you have a feel for which is better? I think i'd rather the newer option, but i don't have any strong opinions.

@pdogr
Copy link
Contributor

pdogr commented Jan 6, 2022

yeah I agree, we should definitely use the tracing crate. I'll try to work on this one.

@pdogr
Copy link
Contributor

pdogr commented Jan 7, 2022

To enable logging to a log file we need to take an optional filepath in dura serve.
Both dura serve --logfile <path_to_logfile> and dura serve <path_to_logfile> should work.

@tkellogg
Copy link
Owner Author

tkellogg commented Jan 8, 2022

I prefer the option approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants