File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ** /logs
Original file line number Diff line number Diff line change @@ -30,12 +30,17 @@ public IEnumerable<WeatherForecast> LogWarning()
3030 var arr = Enumerable . Range ( 1 , 5 )
3131 . Select (
3232 index =>
33- new WeatherForecast
33+ {
34+ var dateTime = DateTime . Now . AddDays ( index ) ;
35+ return new WeatherForecast
3436 {
35- Date = DateOnly . FromDateTime ( DateTime . Now . AddDays ( index ) ) ,
37+ Date = DateOnly . FromDateTime ( dateTime ) ,
38+ DateTime = dateTime ,
39+ DateTimeOffset = DateTimeOffset . UtcNow ,
3640 TemperatureC = Random . Shared . Next ( - 20 , 55 ) ,
3741 Summary = Summaries [ Random . Shared . Next ( Summaries . Length ) ]
38- } )
42+ } ;
43+ } )
3944 . ToArray ( ) ;
4045
4146 _logger . LogWarning ( "result is {@Arr}" , arr ) ;
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ static LoggerConfiguration ConfigureLogger(LoggerConfiguration configuration)
100100 . Enrich
101101 . WithExceptionDetails (
102102 new DestructuringOptionsBuilder ( ) . WithDefaultDestructurers ( )
103- //.WithRootName("x" )
103+ . WithIgnoreStackTraceAndTargetSiteExceptionFilter ( )
104104 . WithDestructurers ( [ new DbUpdateExceptionDestructurer ( ) ] ) ) ;
105105 }
106106 }
Original file line number Diff line number Diff line change @@ -2,11 +2,21 @@ namespace SerilogTest;
22
33public class WeatherForecast
44{
5+
6+ #region Properties
7+
58 public DateOnly Date { get ; set ; }
69
10+ public DateTime DateTime { get ; set ; }
11+
12+ public DateTimeOffset DateTimeOffset { get ; set ; }
13+
14+ public string ? Summary { get ; set ; }
15+
716 public int TemperatureC { get ; set ; }
817
918 public int TemperatureF => 32 + ( int ) ( TemperatureC / 0.5556 ) ;
1019
11- public string ? Summary { get ; set ; }
20+ #endregion
21+
1222}
Original file line number Diff line number Diff line change 3333 {
3434 "Name" : " Console" ,
3535 "Args" : {
36- "outputTemplate" : " {Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {SourceContext} {NewLine}{Message:lj}{NewLine}{Properties:lj}{NewLine}"
36+ "outputTemplate" : " {Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {SourceContext} {NewLine}{Message:lj}{NewLine}{Properties:lj}{NewLine}{Exception}{NewLine} "
3737 }
3838 },
3939 {
4040 "Name" : " File" ,
4141 "Args" : {
4242 "path" : " logs/log-.txt" ,
43- "rollingInterval" : " Minute " ,
43+ "rollingInterval" : " Day " ,
4444 "rollOnFileSizeLimit" : true ,
4545 "fileSizeLimitBytes" : 104857600 ,
4646 "retainedFileCountLimit" : 14 ,
5252 "Args" : {
5353 "restrictedToMinimumLevel" : " Error" ,
5454 "path" : " logs/log-error-.txt" ,
55- "rollingInterval" : " Minute " ,
55+ "rollingInterval" : " Day " ,
5656 "rollOnFileSizeLimit" : true ,
5757 "fileSizeLimitBytes" : 104857600 ,
5858 "retainedFileCountLimit" : 14 ,
You can’t perform that action at this time.
0 commit comments