diff --git a/log/global.go b/log/global.go index f75b07e64..624fccb39 100644 --- a/log/global.go +++ b/log/global.go @@ -27,8 +27,8 @@ func (a *loggerAppliance) SetLogger(in Logger) { a.Logger = in } -func (a *loggerAppliance) GetLogger() Logger { - return a.Logger +func (a *loggerAppliance) Log(level Level, keyvals ...interface{}) error { + return a.Logger.Log(level, keyvals...) } // SetLogger should be called before any other log call. @@ -39,7 +39,7 @@ func SetLogger(logger Logger) { // GetLogger returns global logger appliance as logger in current process. func GetLogger() Logger { - return global.GetLogger() + return global } // Log Print log by level and keyvals. diff --git a/log/global_test.go b/log/global_test.go index 04bb19c51..16aa67738 100644 --- a/log/global_test.go +++ b/log/global_test.go @@ -14,7 +14,7 @@ func TestGlobalLog(t *testing.T) { logger := NewStdLogger(buffer) SetLogger(logger) - if GetLogger() != logger { + if global.Logger != logger { t.Error("GetLogger() is not equal to logger") }