@@ -12,12 +12,22 @@ public static LogEvent InformationEvent(string messageTemplate = "Hello, world!"
1212 return LogEvent ( LogEventLevel . Information , messageTemplate , propertyValues ) ;
1313 }
1414
15+ public static LogEvent InformationEvent ( DateTimeOffset timestamp , string messageTemplate = "Hello, world!" , params object ? [ ] propertyValues )
16+ {
17+ return LogEvent ( timestamp , LogEventLevel . Information , messageTemplate , propertyValues ) ;
18+ }
19+
1520 public static LogEvent WarningEvent ( string messageTemplate = "Hello, world!" , params object ? [ ] propertyValues )
1621 {
1722 return LogEvent ( LogEventLevel . Warning , messageTemplate , propertyValues ) ;
1823 }
1924
2025 public static LogEvent LogEvent ( LogEventLevel level , string messageTemplate = "Hello, world!" , params object ? [ ] propertyValues )
26+ {
27+ return LogEvent ( DateTimeOffset . Now , level , messageTemplate , propertyValues ) ;
28+ }
29+
30+ public static LogEvent LogEvent ( DateTimeOffset timestamp , LogEventLevel level , string messageTemplate = "Hello, world!" , params object ? [ ] propertyValues )
2131 {
2232 var log = new LoggerConfiguration ( ) . CreateLogger ( ) ;
2333#pragma warning disable Serilog004 // Constant MessageTemplate verifier
@@ -26,7 +36,7 @@ public static LogEvent LogEvent(LogEventLevel level, string messageTemplate = "H
2636 {
2737 throw new XunitException ( "Template could not be bound." ) ;
2838 }
29- return new ( DateTimeOffset . Now , level , null , template , properties ) ;
39+ return new ( timestamp , level , null , template , properties ) ;
3040 }
3141
3242 public static object AnonymousObject ( )
0 commit comments