-
Notifications
You must be signed in to change notification settings - Fork 62
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
error logs enabled by default, causing glitches in UI #238
Comments
It turns out this is not a rustls problem -- currently we enable error logs by default. I realized this after 58f03de which adds some more error logs which are enabled by default currently. |
I briefly looked into fixing this, but I think it's not easily possible. We'll probably need to copy the default logger implementation from env_logger/log and modify it so that by default all logs are disabled, and the env variable overrides those defaults. Something like env_logger::builder()
.target(env_logger::Target::Stderr)
.filter_level(log::LevelFilter::Off)
... doesn't work as this overrides the env variable. We want to override the default, not the settings generated from the env variable. Here's another idea which may be a better fix for this issue. Leave error logs on by default, but redirect all logs to a file by default (e.g. tiny_logs.txt). I think we could even redirect all of stderr to a file by default, as it doesn't make sense to print to the terminal in a TUI app. So perhaps it's a good idea to create two files by default: tiny_stderr.txt and tiny_logs.txt. These are purely for debugging purposes. The question is where to create those. One idea is in the log dir, but that's not always available. |
Ugh.. it seems like env_logger doesn't support logging to a file: https://docs.rs/env_logger/0.7.1/env_logger/enum.Target.html |
Perhaps we can use flexi_logger which can log to files. |
I just pushed a branch that uses flexi_logger instead of env_logger. It already fixes the bug as apparently flexi_logger doesn't enable ERROR logs by default. Another benefit is the release binary size gets 11.6% smaller! (from 6766352 bytes to 5975432 bytes) Amazing. Only problem is flexi_logger creates the log file by default. I'd prefer it if it created the file on first log. That way we could avoid creating a file most of the time. Perhaps it's already possible somehow with a setting but I couldn't immediately see it in the documentation and I have to get back to work now. |
This is probably because I disabled default features which we don't use. We could do the same in env_logger as well. |
If I use this for env_logger:
Then flexi_logger is larger. Binary size increases by 5.2% (from 5677784 bytes to 5975432 bytes). So flexi_logger is actually worse. |
Try this config with a rustls build:
tiny will be dumping this stuff to stderr:
Normally logs enabled manually, with something like
RUST_LOG=debug tiny
. I don't know why these are enabled by default.The text was updated successfully, but these errors were encountered: