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
|
// SetReportCaller sets whether the standard logger will include the calling
|
||||||
// method as a field.
|
// method as a field.
|
||||||
func SetReportCaller(include bool) {
|
func SetReportCaller(include bool) {
|
||||||
std.mu.Lock()
|
std.SetReportCaller(include)
|
||||||
defer std.mu.Unlock()
|
|
||||||
std.ReportCaller = include
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetLevel sets the standard logger level.
|
// SetLevel sets the standard logger level.
|
||||||
|
|
|
@ -399,6 +399,12 @@ func (logger *Logger) SetOutput(output io.Writer) {
|
||||||
logger.Out = output
|
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
|
// ReplaceHooks replaces the logger hooks and returns the old ones
|
||||||
func (logger *Logger) ReplaceHooks(hooks LevelHooks) LevelHooks {
|
func (logger *Logger) ReplaceHooks(hooks LevelHooks) LevelHooks {
|
||||||
logger.mu.Lock()
|
logger.mu.Lock()
|
||||||
|
|
Loading…
Reference in New Issue