33// </copyright>
44
55using System ;
6+ using System . Diagnostics . CodeAnalysis ;
67using System . Runtime . CompilerServices ;
78
89namespace AdvancedSharpAdbClient . Logs
@@ -23,7 +24,7 @@ public static class LoggerExtensions
2324 /// <param name="args">An object array that contains zero or more objects to format.</param>
2425 /// <example>logger.LogDebug(exception, "Error while processing request from {Address}", address)</example>
2526 [ MethodImpl ( ( MethodImplOptions ) 0x100 ) ]
26- public static void LogDebug ( this ILogger logger , Exception ? exception , string ? message , params object ? [ ] args ) =>
27+ public static void LogDebug ( this ILogger logger , Exception ? exception , [ StringSyntax ( StringSyntaxAttribute . CompositeFormat ) ] string ? message , params object ? [ ] args ) =>
2728 logger . Log ( LogLevel . Debug , exception , message , args ) ;
2829
2930 /// <summary>
@@ -34,7 +35,7 @@ public static void LogDebug(this ILogger logger, Exception? exception, string? m
3435 /// <param name="args">An object array that contains zero or more objects to format.</param>
3536 /// <example>logger.LogDebug("Processing request from {Address}", address)</example>
3637 [ MethodImpl ( ( MethodImplOptions ) 0x100 ) ]
37- public static void LogDebug ( this ILogger logger , string ? message , params object ? [ ] args ) =>
38+ public static void LogDebug ( this ILogger logger , [ StringSyntax ( StringSyntaxAttribute . CompositeFormat ) ] string ? message , params object ? [ ] args ) =>
3839 logger . Log ( LogLevel . Debug , message , args ) ;
3940
4041 //------------------------------------------TRACE------------------------------------------//
@@ -48,7 +49,7 @@ public static void LogDebug(this ILogger logger, string? message, params object?
4849 /// <param name="args">An object array that contains zero or more objects to format.</param>
4950 /// <example>logger.LogTrace(exception, "Error while processing request from {Address}", address)</example>
5051 [ MethodImpl ( ( MethodImplOptions ) 0x100 ) ]
51- public static void LogTrace ( this ILogger logger , Exception ? exception , string ? message , params object ? [ ] args ) =>
52+ public static void LogTrace ( this ILogger logger , Exception ? exception , [ StringSyntax ( StringSyntaxAttribute . CompositeFormat ) ] string ? message , params object ? [ ] args ) =>
5253 logger . Log ( LogLevel . Trace , exception , message , args ) ;
5354
5455 /// <summary>
@@ -59,7 +60,7 @@ public static void LogTrace(this ILogger logger, Exception? exception, string? m
5960 /// <param name="args">An object array that contains zero or more objects to format.</param>
6061 /// <example>logger.LogTrace("Processing request from {Address}", address)</example>
6162 [ MethodImpl ( ( MethodImplOptions ) 0x100 ) ]
62- public static void LogTrace ( this ILogger logger , string ? message , params object ? [ ] args ) =>
63+ public static void LogTrace ( this ILogger logger , [ StringSyntax ( StringSyntaxAttribute . CompositeFormat ) ] string ? message , params object ? [ ] args ) =>
6364 logger . Log ( LogLevel . Trace , message , args ) ;
6465
6566 //------------------------------------------INFORMATION------------------------------------------//
@@ -73,7 +74,7 @@ public static void LogTrace(this ILogger logger, string? message, params object?
7374 /// <param name="args">An object array that contains zero or more objects to format.</param>
7475 /// <example>logger.LogInformation(exception, "Error while processing request from {Address}", address)</example>
7576 [ MethodImpl ( ( MethodImplOptions ) 0x100 ) ]
76- public static void LogInformation ( this ILogger logger , Exception ? exception , string ? message , params object ? [ ] args ) =>
77+ public static void LogInformation ( this ILogger logger , Exception ? exception , [ StringSyntax ( StringSyntaxAttribute . CompositeFormat ) ] string ? message , params object ? [ ] args ) =>
7778 logger . Log ( LogLevel . Information , exception , message , args ) ;
7879
7980 /// <summary>
@@ -84,7 +85,7 @@ public static void LogInformation(this ILogger logger, Exception? exception, str
8485 /// <param name="args">An object array that contains zero or more objects to format.</param>
8586 /// <example>logger.LogInformation("Processing request from {Address}", address)</example>
8687 [ MethodImpl ( ( MethodImplOptions ) 0x100 ) ]
87- public static void LogInformation ( this ILogger logger , string ? message , params object ? [ ] args ) =>
88+ public static void LogInformation ( this ILogger logger , [ StringSyntax ( StringSyntaxAttribute . CompositeFormat ) ] string ? message , params object ? [ ] args ) =>
8889 logger . Log ( LogLevel . Information , message , args ) ;
8990
9091 //------------------------------------------WARNING------------------------------------------//
@@ -98,7 +99,7 @@ public static void LogInformation(this ILogger logger, string? message, params o
9899 /// <param name="args">An object array that contains zero or more objects to format.</param>
99100 /// <example>logger.LogWarning(exception, "Error while processing request from {Address}", address)</example>
100101 [ MethodImpl ( ( MethodImplOptions ) 0x100 ) ]
101- public static void LogWarning ( this ILogger logger , Exception ? exception , string ? message , params object ? [ ] args ) =>
102+ public static void LogWarning ( this ILogger logger , Exception ? exception , [ StringSyntax ( StringSyntaxAttribute . CompositeFormat ) ] string ? message , params object ? [ ] args ) =>
102103 logger . Log ( LogLevel . Warning , exception , message , args ) ;
103104
104105 /// <summary>
@@ -109,7 +110,7 @@ public static void LogWarning(this ILogger logger, Exception? exception, string?
109110 /// <param name="args">An object array that contains zero or more objects to format.</param>
110111 /// <example>logger.LogWarning("Processing request from {Address}", address)</example>
111112 [ MethodImpl ( ( MethodImplOptions ) 0x100 ) ]
112- public static void LogWarning ( this ILogger logger , string ? message , params object ? [ ] args ) =>
113+ public static void LogWarning ( this ILogger logger , [ StringSyntax ( StringSyntaxAttribute . CompositeFormat ) ] string ? message , params object ? [ ] args ) =>
113114 logger . Log ( LogLevel . Warning , message , args ) ;
114115
115116 //------------------------------------------ERROR------------------------------------------//
@@ -123,7 +124,7 @@ public static void LogWarning(this ILogger logger, string? message, params objec
123124 /// <param name="args">An object array that contains zero or more objects to format.</param>
124125 /// <example>logger.LogError(exception, "Error while processing request from {Address}", address)</example>
125126 [ MethodImpl ( ( MethodImplOptions ) 0x100 ) ]
126- public static void LogError ( this ILogger logger , Exception ? exception , string ? message , params object ? [ ] args ) =>
127+ public static void LogError ( this ILogger logger , Exception ? exception , [ StringSyntax ( StringSyntaxAttribute . CompositeFormat ) ] string ? message , params object ? [ ] args ) =>
127128 logger . Log ( LogLevel . Error , exception , message , args ) ;
128129
129130 /// <summary>
@@ -134,7 +135,7 @@ public static void LogError(this ILogger logger, Exception? exception, string? m
134135 /// <param name="args">An object array that contains zero or more objects to format.</param>
135136 /// <example>logger.LogError("Processing request from {Address}", address)</example>
136137 [ MethodImpl ( ( MethodImplOptions ) 0x100 ) ]
137- public static void LogError ( this ILogger logger , string ? message , params object ? [ ] args ) =>
138+ public static void LogError ( this ILogger logger , [ StringSyntax ( StringSyntaxAttribute . CompositeFormat ) ] string ? message , params object ? [ ] args ) =>
138139 logger . Log ( LogLevel . Error , message , args ) ;
139140
140141 //------------------------------------------CRITICAL------------------------------------------//
@@ -148,7 +149,7 @@ public static void LogError(this ILogger logger, string? message, params object?
148149 /// <param name="args">An object array that contains zero or more objects to format.</param>
149150 /// <example>logger.LogCritical(exception, "Error while processing request from {Address}", address)</example>
150151 [ MethodImpl ( ( MethodImplOptions ) 0x100 ) ]
151- public static void LogCritical ( this ILogger logger , Exception ? exception , string ? message , params object ? [ ] args ) =>
152+ public static void LogCritical ( this ILogger logger , Exception ? exception , [ StringSyntax ( StringSyntaxAttribute . CompositeFormat ) ] string ? message , params object ? [ ] args ) =>
152153 logger . Log ( LogLevel . Critical , exception , message , args ) ;
153154
154155 /// <summary>
@@ -159,7 +160,7 @@ public static void LogCritical(this ILogger logger, Exception? exception, string
159160 /// <param name="args">An object array that contains zero or more objects to format.</param>
160161 /// <example>logger.LogCritical("Processing request from {Address}", address)</example>
161162 [ MethodImpl ( ( MethodImplOptions ) 0x100 ) ]
162- public static void LogCritical ( this ILogger logger , string ? message , params object ? [ ] args ) =>
163+ public static void LogCritical ( this ILogger logger , [ StringSyntax ( StringSyntaxAttribute . CompositeFormat ) ] string ? message , params object ? [ ] args ) =>
163164 logger . Log ( LogLevel . Critical , message , args ) ;
164165
165166 /// <summary>
@@ -170,7 +171,7 @@ public static void LogCritical(this ILogger logger, string? message, params obje
170171 /// <param name="message">Format string of the log message.</param>
171172 /// <param name="args">An object array that contains zero or more objects to format.</param>
172173 [ MethodImpl ( ( MethodImplOptions ) 0x100 ) ]
173- public static void Log ( this ILogger logger , LogLevel logLevel , string ? message , params object ? [ ] args ) =>
174+ public static void Log ( this ILogger logger , LogLevel logLevel , [ StringSyntax ( StringSyntaxAttribute . CompositeFormat ) ] string ? message , params object ? [ ] args ) =>
174175 logger . Log ( logLevel , null , message , args ) ;
175176 }
176177}
0 commit comments