@@ -60,8 +60,11 @@ private[scalalogging] object LoggerTakingImplicitMacro {
60
60
}}
61
61
}
62
62
63
-
64
-
63
+ def errorCode [A : Type ](underlying : Expr [Underlying ], canLogEv : Expr [CanLog [A ]], body : Expr [Unit ])(a : Expr [A ])(using Quotes ) =
64
+ ' {if ($underlying.isErrorEnabled) {
65
+ $body
66
+ $canLogEv.afterLog($a)
67
+ }}
65
68
66
69
// Warn
67
70
@@ -117,9 +120,13 @@ private[scalalogging] object LoggerTakingImplicitMacro {
117
120
}}
118
121
}
119
122
123
+ def warnCode [A : Type ](underlying : Expr [Underlying ], canLogEv : Expr [CanLog [A ]], body : Expr [Unit ])(a : Expr [A ])(using Quotes ) =
124
+ ' { if ($underlying.isWarnEnabled) {
125
+ $body
126
+ $canLogEv.afterLog($a)
127
+ }}
120
128
121
129
122
-
123
130
// Info
124
131
125
132
def infoMessage [A : Type ](underlying : Expr [Underlying ], canLogEv : Expr [CanLog [A ]], message : Expr [String ])(a : Expr [A ])(using Quotes ): Expr [Unit ] =
@@ -174,9 +181,13 @@ private[scalalogging] object LoggerTakingImplicitMacro {
174
181
}}
175
182
}
176
183
184
+ def infoCode [A : Type ](underlying : Expr [Underlying ], canLogEv : Expr [CanLog [A ]], body : Expr [Unit ])(a : Expr [A ])(using Quotes ) =
185
+ ' { if ($underlying.isInfoEnabled) {
186
+ $body
187
+ $canLogEv.afterLog($a)
188
+ }}
177
189
178
190
179
-
180
191
// Debug
181
192
182
193
def debugMessage [A : Type ](underlying : Expr [Underlying ], canLogEv : Expr [CanLog [A ]], message : Expr [String ])(a : Expr [A ])(using Quotes ): Expr [Unit ] =
@@ -231,9 +242,13 @@ private[scalalogging] object LoggerTakingImplicitMacro {
231
242
}}
232
243
}
233
244
245
+ def debugCode [A : Type ](underlying : Expr [Underlying ], canLogEv : Expr [CanLog [A ]], body : Expr [Unit ])(a : Expr [A ])(using Quotes ) =
246
+ ' { if ($underlying.isDebugEnabled) {
247
+ $body
248
+ $canLogEv.afterLog($a)
249
+ }}
250
+
234
251
235
-
236
-
237
252
// Trace
238
253
239
254
def traceMessage [A : Type ](underlying : Expr [Underlying ], canLogEv : Expr [CanLog [A ]], message : Expr [String ])(a : Expr [A ])(using Quotes ): Expr [Unit ] =
@@ -287,4 +302,10 @@ private[scalalogging] object LoggerTakingImplicitMacro {
287
302
$canLogEv.afterLog($a)
288
303
}}
289
304
}
305
+
306
+ def traceCode [A : Type ](underlying : Expr [Underlying ], canLogEv : Expr [CanLog [A ]], body : Expr [Unit ])(a : Expr [A ])(using Quotes ) =
307
+ ' { if ($underlying.isTraceEnabled) {
308
+ $body
309
+ $canLogEv.afterLog($a)
310
+ }}
290
311
}
0 commit comments