We want timing information on our application to create nice images. This requires log files in CSV format, as reading in JSON in R is pretty slow, once the log files reach a certain size. It seems like CSV files are parsed much quicker. This is not supported by the tracing crate out of the box, I think.
I would prefer the tracing crate, over a custom solution, since we are using this dependency anyway. We can time methods using the #[instrument] directive and the framework takes care of most of the other stuff.
After tinkering around with the tracing crate, I think we should go for the following solution:
Use the tracing crate for timing the application
Either implement a custom formatter, which requires a custom writer, as well as a custom visitor, to properly write the data we need. This is not particularly handy, because it requires a lot of infrastructure
My preferred solution is to directly implement the Layer trait, which gives full control over state management and filtering. This disables us from using all the infrastructure the tracing_subscriber crate has for writing and formatting logs, but it is complicated to use anyway. I think it is easier to do it this way.
We want timing information on our application to create nice images. This requires log files in CSV format, as reading in JSON in R is pretty slow, once the log files reach a certain size. It seems like CSV files are parsed much quicker. This is not supported by the tracing crate out of the box, I think.
I would prefer the tracing crate, over a custom solution, since we are using this dependency anyway. We can time methods using the
#[instrument]
directive and the framework takes care of most of the other stuff.After tinkering around with the tracing crate, I think we should go for the following solution:
Layer
trait, which gives full control over state management and filtering. This disables us from using all the infrastructure thetracing_subscriber
crate has for writing and formatting logs, but it is complicated to use anyway. I think it is easier to do it this way.