[lxc-devel] [lxd/master] remove logging import
tych0 on Github
lxc-bot at linuxcontainers.org
Tue Oct 4 20:51:58 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 787 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161004/fe7bacbb/attachment.bin>
-------------- next part --------------
From 9d016021c92863e23fdad1961de31bce5f895d59 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Tue, 4 Oct 2016 13:42:08 -0600
Subject: [PATCH] remove logging import
downstream users of shared/ (i.e. juju) don't want to have a log15
dependency.
log.Ctx() is defined as a map[string]interface{}, but the log15 package
does some fancy stuff to normalize it when it gets passed, which is why we
needed to wrap it in a log.Ctx() again. Instead, let's just not unwrap the
type in the first place, which means log15's machinery will see the log.Ctx
users passed us and behave correctly.
Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
shared/log.go | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/shared/log.go b/shared/log.go
index bfaa8f0..792ccf6 100644
--- a/shared/log.go
+++ b/shared/log.go
@@ -2,7 +2,6 @@ package shared
import (
"fmt"
- log "gopkg.in/inconshreveable/log15.v2"
"runtime"
)
@@ -29,33 +28,33 @@ func init() {
}
// General wrappers around Logger interface functions.
-func LogDebug(msg string, ctx map[string]interface{}) {
+func LogDebug(msg string, ctx interface{}) {
if Log != nil {
- Log.Debug(msg, log.Ctx(ctx))
+ Log.Debug(msg, ctx)
}
}
-func LogInfo(msg string, ctx map[string]interface{}) {
+func LogInfo(msg string, ctx interface{}) {
if Log != nil {
- Log.Info(msg, log.Ctx(ctx))
+ Log.Info(msg, ctx)
}
}
-func LogWarn(msg string, ctx map[string]interface{}) {
+func LogWarn(msg string, ctx interface{}) {
if Log != nil {
- Log.Warn(msg, log.Ctx(ctx))
+ Log.Warn(msg, ctx)
}
}
-func LogError(msg string, ctx map[string]interface{}) {
+func LogError(msg string, ctx interface{}) {
if Log != nil {
- Log.Error(msg, log.Ctx(ctx))
+ Log.Error(msg, ctx)
}
}
-func LogCrit(msg string, ctx map[string]interface{}) {
+func LogCrit(msg string, ctx interface{}) {
if Log != nil {
- Log.Crit(msg, log.Ctx(ctx))
+ Log.Crit(msg, ctx)
}
}
More information about the lxc-devel
mailing list