-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
I'm currently using the Json drain to write to a TCP port like this:
let writer = TcpStream::connect("localhost:5000").unwrap();
let drain = slog_json::Json::default(writer);
let logger = slog::Logger::root(Mutex::new(drain).map(slog::Fuse), o!());The problem with this approach is that the JSON serializer will call write() on the TCP connection for every token ({, ", msg, ", : etc.). I believe this results in quite a performance hit.
I'm thinking to use a BufWriter around the TcpStream to allow buffering of the individual writes. To ensure that every log message is sent through the wire I'd want to call flush() after each message though.
Do you think that's a good solution?
I will open a pull request to add the flush() call if you agree.
Metadata
Metadata
Assignees
Labels
No labels