Set report caller to true only for certain log levels
Closed this issue · 1 comments
coin-au-carre commented
For instance I want to set:
log.SetReportCaller(true)
forlog.warn
and log.error`log.SetReportCaller(false)
for all other log levels
Is it possible easily?
aymanbagabas commented
Hi @coin-au-carre, you can achieve that by using two Log instances, one with SetReportCaller(true)
and SetLevel(WarnLevel)
, and the other with default values. Then wrap them in your custom type and override the Warn
method to use the appropriate logger. Hope this helps 🙂