11using System ;
22using System . Diagnostics ;
3+ using System . Runtime . CompilerServices ;
34using System . Threading ;
45using System . Threading . Tasks ;
56using DotNetCampus . Logging ;
@@ -40,6 +41,41 @@ public static void Main(string[] args)
4041 Log . Error ( "Error log" ) ;
4142 Log . Fatal ( "Fatal log" ) ;
4243
44+ Log . Trace ( """
45+ This is a very very long trace log
46+ written in multiline.
47+ """ ) ;
48+ Log . Debug ( """
49+ This is a very very long debug log
50+ written in multiline.
51+ """ ) ;
52+ Log . Info ( """
53+ This is a very very long information log
54+ written in multiline.
55+ """ ) ;
56+ Log . Warn ( """
57+ This is a very very long warning log
58+ written in multiline.
59+ """ ) ;
60+ Log . Error ( """
61+ This is a very very long error log
62+ written in multiline.
63+ """ ) ;
64+ Log . Fatal ( """
65+ This is a very very long critical log
66+ written in multiline.
67+ """ ) ;
68+ Log . Fatal ( """
69+ This is a very very long critical log
70+ written in multiline.
71+ """ ) ;
72+
73+ var exception = GetException ( ) ;
74+ Log . Warn ( "Ah..., exception!" , exception ) ;
75+ Log . Error ( "Ah..., exception!" , exception ) ;
76+ Log . Fatal ( "Ah..., exception!" , exception ) ;
77+ Log . Fatal ( "Ah..., exception!" , exception ) ;
78+
4379 Run ( ) ;
4480 Thread . Sleep ( 5000 ) ;
4581 }
@@ -55,6 +91,25 @@ private static void Run()
5591 } ) ;
5692 Log . Info ( $ "[TEST] 完成 { stopwatch . ElapsedMilliseconds } ms") ;
5793 }
94+
95+ [ MethodImpl ( MethodImplOptions . NoInlining ) ]
96+ private static Exception GetException ( )
97+ {
98+ try
99+ {
100+ return ThrowException ( ) ;
101+ }
102+ catch ( Exception ex )
103+ {
104+ return ex ;
105+ }
106+ }
107+
108+ [ MethodImpl ( MethodImplOptions . NoInlining ) ]
109+ private static Exception ThrowException ( )
110+ {
111+ throw new InvalidOperationException ( ) ;
112+ }
58113}
59114
60115[ ImportLoggerBridge < global ::LoggerSample . LoggerIndependentLibrary . Logging . ILoggerBridge > ]
0 commit comments