First cut at adding calling method
If log.SetReportMethod(true) then method=PACKAGE.FUNCTION will be added as a field to log lines. eg: time="2016-11-25T19:04:43-08:00" level=info method=main msg="log testing" TODO: documentation, examples
This commit is contained in:
+16
@@ -27,6 +27,22 @@ func SetFormatter(formatter Formatter) {
|
||||
std.Formatter = formatter
|
||||
}
|
||||
|
||||
// SetReportMethod sets whether to include calling method and line as
|
||||
// fields
|
||||
func SetReportMethod(include bool) {
|
||||
std.mu.Lock()
|
||||
defer std.mu.Unlock()
|
||||
std.ReportMethod = include
|
||||
}
|
||||
|
||||
// ReportMethod sets whether to include calling method and line as
|
||||
// fields
|
||||
func ReportMethod() bool {
|
||||
std.mu.Lock()
|
||||
defer std.mu.Unlock()
|
||||
return std.ReportMethod
|
||||
}
|
||||
|
||||
// SetLevel sets the standard logger level.
|
||||
func SetLevel(level Level) {
|
||||
std.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user