forked from mirror/logrus
add a SetReportCaller on Logger object
This commit is contained in:
parent
64d5b7e66c
commit
5fcd19eae6
|
@ -27,9 +27,7 @@ func SetFormatter(formatter Formatter) {
|
|||
// SetReportCaller sets whether the standard logger will include the calling
|
||||
// method as a field.
|
||||
func SetReportCaller(include bool) {
|
||||
std.mu.Lock()
|
||||
defer std.mu.Unlock()
|
||||
std.ReportCaller = include
|
||||
std.SetReportCaller(include)
|
||||
}
|
||||
|
||||
// SetLevel sets the standard logger level.
|
||||
|
|
|
@ -399,6 +399,12 @@ func (logger *Logger) SetOutput(output io.Writer) {
|
|||
logger.Out = output
|
||||
}
|
||||
|
||||
func (logger *Logger) SetReportCaller(reportCaller bool) {
|
||||
logger.mu.Lock()
|
||||
defer logger.mu.Unlock()
|
||||
logger.ReportCaller = reportCaller
|
||||
}
|
||||
|
||||
// ReplaceHooks replaces the logger hooks and returns the old ones
|
||||
func (logger *Logger) ReplaceHooks(hooks LevelHooks) LevelHooks {
|
||||
logger.mu.Lock()
|
||||
|
|
Loading…
Reference in New Issue