Commit 50db9810 by bergquist

uses pluginmanagers log instead of global

parent e6921a6a
...@@ -236,8 +236,8 @@ func LogFilterHandler(maxLevel log15.Lvl, filters map[string]log15.Lvl, h log15. ...@@ -236,8 +236,8 @@ func LogFilterHandler(maxLevel log15.Lvl, filters map[string]log15.Lvl, h log15.
if len(filters) > 0 { if len(filters) > 0 {
for i := 0; i < len(r.Ctx); i += 2 { for i := 0; i < len(r.Ctx); i += 2 {
key := r.Ctx[i].(string) key, ok := r.Ctx[i].(string)
if key == "logger" { if ok && key == "logger" {
loggerName, strOk := r.Ctx[i+1].(string) loggerName, strOk := r.Ctx[i+1].(string)
if strOk { if strOk {
if filterLevel, ok := filters[loggerName]; ok { if filterLevel, ok := filters[loggerName]; ok {
......
...@@ -12,19 +12,19 @@ type LogWrapper struct { ...@@ -12,19 +12,19 @@ type LogWrapper struct {
} }
func (lw LogWrapper) Trace(msg string, args ...interface{}) { func (lw LogWrapper) Trace(msg string, args ...interface{}) {
glog.Debug2(msg, args...) lw.Logger.Debug(msg, args...)
} }
func (lw LogWrapper) Debug(msg string, args ...interface{}) { func (lw LogWrapper) Debug(msg string, args ...interface{}) {
glog.Debug2(msg, args...) lw.Logger.Debug(msg, args...)
} }
func (lw LogWrapper) Info(msg string, args ...interface{}) { func (lw LogWrapper) Info(msg string, args ...interface{}) {
glog.Info2(msg, args...) lw.Logger.Info(msg, args...)
} }
func (lw LogWrapper) Warn(msg string, args ...interface{}) { func (lw LogWrapper) Warn(msg string, args ...interface{}) {
glog.Warn2(msg, args...) lw.Logger.Warn(msg, args...)
} }
func (lw LogWrapper) Error(msg string, args ...interface{}) { func (lw LogWrapper) Error(msg string, args ...interface{}) {
glog.Error2(msg, args...) lw.Logger.Error(msg, args...)
} }
func (lw LogWrapper) IsTrace() bool { return true } func (lw LogWrapper) IsTrace() bool { return true }
...@@ -34,13 +34,14 @@ func (lw LogWrapper) IsWarn() bool { return true } ...@@ -34,13 +34,14 @@ func (lw LogWrapper) IsWarn() bool { return true }
func (lw LogWrapper) IsError() bool { return true } func (lw LogWrapper) IsError() bool { return true }
func (lw LogWrapper) With(args ...interface{}) hclog.Logger { func (lw LogWrapper) With(args ...interface{}) hclog.Logger {
return LogWrapper{Logger: glog.New("logger", args)} return LogWrapper{Logger: lw.Logger.New(args...)}
} }
func (lw LogWrapper) Named(name string) hclog.Logger { func (lw LogWrapper) Named(name string) hclog.Logger {
return LogWrapper{Logger: glog.New(name)} return LogWrapper{Logger: lw.Logger.New()}
} }
func (lw LogWrapper) ResetNamed(name string) hclog.Logger { func (lw LogWrapper) ResetNamed(name string) hclog.Logger {
return LogWrapper{Logger: glog.New(name)} return LogWrapper{Logger: lw.Logger.New()}
} }
func (lw LogWrapper) StandardLogger(ops *hclog.StandardLoggerOptions) *log.Logger { func (lw LogWrapper) StandardLogger(ops *hclog.StandardLoggerOptions) *log.Logger {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment