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

Add log4rs to print log messages to a file #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KarlHeitmann
Copy link
Contributor

I like this tui crate, and I've built some "explorer" applications with it (to git commit explorer (very similar to this project), a wrapper for ripgrep to explore files and an explorer for Ruby on Rails projects)

tui is an awesome crate, but for me sometimes is very difficult to get to know what is happening under the hood when my applications are not working as expected. That's why I decided to use a logger on my latest explorer project (rails_explorer), and found out that this log4rs is very useful.

I don't know what is your criteria to add other crates to your project. But this is a suggestion. If you have a better technique (eg: you use a debugger or a special IDE or another rust feature to build your project) let me know so I can study your code and start contributing. I need a good tool to use on my personal and work related github repos.

Commit message:

You can use this crate to send log messages to a file, there are 5 level filters for logging:

Error
Warn
Info
Debug
Trace

To use it, just add one of these lines to the code. You can use the format as println!()

log::error!("...");
log::warn!("...");
log::info!("...");
log::debug!("...");
log::trace!("...");

The example setup provided here is taken from
https://github.com/estk/log4rs/blob/master/examples/log_to_file.rs

You can use this crate to send log messages to a file, there are 5 level
filters for logging:

Error
Warn
Info
Debug
Trace

To use it, just add one of these lines to the code. You can use the
format as println!()

log::error!("...");
log::warn!("...");
log::info!("...");
log::debug!("...");
log::trace!("...");

The example setup provided here is taken from
https://github.com/estk/log4rs/blob/master/examples/log_to_file.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant