The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2456

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
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.ander...@canonical.com>
From 9d016021c92863e23fdad1961de31bce5f895d59 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.ander...@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.ander...@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)
        }
 }
 
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to