-
Notifications
You must be signed in to change notification settings - Fork 794
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
Want the text log to split folders by month!! #1406
Comments
Hi! Try installing Serilog.Sinks.Map and using: .WriteTo.Map(
le => new DateTime(le.Timestamp,Year, le.Timestamp.Month, le.Timestamp.Day),
(month, wt) => wt.File($"{month:yyyy-MM}/log-.txt", rollingInterval: RollingInterval.Day),
sinkMapCountLimit: 1) |
OK can be used. Can I get the log level in the map? In this way, only one configuration is needed. Otherwise, it needs to be written many times such as .WriteTo.Map( How to get {log. Level}? I want to split files by level Write it now many times, The only difference is the level part: .WriteTo.Map( .WriteTo.Map( .WriteTo.Map( |
|
With tuple packaging, that's fine. Thank you!! .WriteTo.Map( |
Hi I have a need,
Output file mode want to add dynamic folder。
For example, by month
d:/logs/project-a/2020-01/log20200101.txt
d:/logs/project-a/2020-02/log20200201.txt
d:/logs/project-a/2020-03/log20200301.txt
Can the implementation callback?
such as
.WriteTo.File(() => $"{DateTime.Now.ToString("yyyy-MM")}/Debug-.txt", rollingInterval: RollingInterval.Day)
Because we have our own plan to clean up the logs, we want to split the folders by month
thanks!!!
The text was updated successfully, but these errors were encountered: