Optionally format log file path with time in time point file rotator#78
Optionally format log file path with time in time point file rotator#78fpervaiz wants to merge 2 commits intoSpriteOvO:mainfrom
Conversation
There was a problem hiding this comment.
Sorry for the very late review.
Customizing rotated file names is a meaningful feature, and it would certainly be nice if we have it, but I think this implementation is a bit misleading.
The chrono crate is under the hood and not visible to users. Besides that, RotatingFileSink also has time-irrelevant rotation policies. So exposing the chrono's time format directly to the path string parameter is not a good idea I think.
A possible better implementation is from C++ spdlog https://github.com/gabime/spdlog/blob/7cbf2a696764f3c2c84ff4b8eb592fce5924919e/include/spdlog/sinks/daily_file_sink.h#L68 - we have a somehow callback parameter, passing policy-related information into it, and the user returns the custom file path they expected. The right path might be this, but I haven't have time to figure out the details of the API designs recently (a bit busy sorry). I'll probably reply later with more details or you can feel free to explore it yourself then we discuss :)
Aim is to allow custom file names and paths on time point rotation, rather than the default behaviour of appending the date/time to the file name given in the base path.