#Need a fast library to write logs to a file, does tracing do this?
22 messages ยท Page 1 of 1 (latest)
The standard is the log crate, it is used by pretty much all libraries (which need) to log messages of different log levels
So you get both output of libraries that need to log, and you can log stuff yourself
Note however that the log crate doesn't do logging, it is merely a logging abstraction which is logger-agnostic
Libraries and binaries can use the log crate's macros but without a logger registered they will do nothing
Look here for some Logger implementations: https://docs.rs/log/latest/log/index.html#available-logging-implementations
If you need async logging then this might be nice: https://github.com/rbatis/fast_log
Although if you are in need of async logging then there's likely a better implementation you can write depending on your project (it's not hard to write a logger at all)
but the log api doesn't support logging to file
It does, as I explained the log crate is logger-agnostic. You can have any code logging on one end (using log macros) and a logger on the other end receiving those records and doing whatever it wants with them
.
i'm not sure i follow. i don't want to implement my own write to file -- i'd like it built in, and as far as i can tell, log doesn't have a write to file macro so it depends on the specific implementation decides to include it in their library api, e.g. env-logger doesn't support logging to file and i have to implement it myself
i'm not sure fast_log is production ready, i was looking tracing bc it appears to be the most popular
and log4rs for example, which does support writing to file, is too slow for my application
ahh then yes it's probably best to use tracing, if you're using something like Tokio
For some reason I assumed you are talking about a sync application ๐
yeah sorry i forgot to mention that, i'm using tokio in my application
(In which case an async implementation would mean extra overhead)
Yeah then tracing is golden
but do you know if it has a write to file implementation?