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

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) ===
I'd like to use it in another project of mine :)

Signed-off-by: Stéphane Graber <[email protected]>
From ad52e51e6f09dc357bd87a30a19dcc7a62e58888 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]>
Date: Mon, 1 May 2017 21:57:44 -0400
Subject: [PATCH] shared/logging: Export LogfmtFormat
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

I'd like to use it in another project of mine :)

Signed-off-by: Stéphane Graber <[email protected]>
---
 shared/logging/format.go | 3 ++-
 shared/logging/log.go    | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/shared/logging/format.go b/shared/logging/format.go
index 93ddda6..d60b7e4 100644
--- a/shared/logging/format.go
+++ b/shared/logging/format.go
@@ -67,7 +67,8 @@ func TerminalFormat() log.Format {
        })
 }
 
-func logfmtFormat() log.Format {
+// LogfmtFormat return a formatter for a text log file
+func LogfmtFormat() log.Format {
        return log.FormatFunc(func(r *log.Record) []byte {
                common := []interface{}{r.KeyNames.Time, r.Time, 
r.KeyNames.Lvl, r.Lvl, r.KeyNames.Msg, r.Msg}
                buf := &bytes.Buffer{}
diff --git a/shared/logging/log.go b/shared/logging/log.go
index 8d6bf2a..8602341 100644
--- a/shared/logging/log.go
+++ b/shared/logging/log.go
@@ -19,7 +19,7 @@ func GetLogger(syslog string, logfile string, verbose bool, 
debug bool, customHa
        var syshandler log.Handler
 
        // Format handler
-       format := logfmtFormat()
+       format := LogfmtFormat()
        if term.IsTty(os.Stderr.Fd()) {
                format = TerminalFormat()
        }
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to