From 905242e00a7e9711adf6864a46495eb944bcfa2e Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Wed, 28 Jan 2015 14:33:15 -0800 Subject: [PATCH] Fix logs, so now, old and followed logs has same format without [] Signed-off-by: Alexander Morozov --- jsonlog/jsonlog.go | 2 +- jsonlog/jsonlog_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jsonlog/jsonlog.go b/jsonlog/jsonlog.go index 3a96d86..e2c2a2c 100644 --- a/jsonlog/jsonlog.go +++ b/jsonlog/jsonlog.go @@ -23,7 +23,7 @@ func (jl *JSONLog) Format(format string) (string, error) { m, err := json.Marshal(jl) return string(m), err } - return fmt.Sprintf("[%s] %s", jl.Created.Format(format), jl.Log), nil + return fmt.Sprintf("%s %s", jl.Created.Format(format), jl.Log), nil } func (jl *JSONLog) Reset() { diff --git a/jsonlog/jsonlog_test.go b/jsonlog/jsonlog_test.go index 5ee5eda..fa53825 100644 --- a/jsonlog/jsonlog_test.go +++ b/jsonlog/jsonlog_test.go @@ -30,7 +30,8 @@ func TestWriteLog(t *testing.T) { if len(lines) != 30 { t.Fatalf("Must be 30 lines but got %d", len(lines)) } - logRe := regexp.MustCompile(`\[.*\] Line that thinks that it is log line from docker`) + // 30+ symbols, five more can come from system timezone + logRe := regexp.MustCompile(`.{30,} Line that thinks that it is log line from docker`) for _, l := range lines { if !logRe.MatchString(l) { t.Fatalf("Log line not in expected format: %q", l)