Skip to content
This repository was archived by the owner on Jun 4, 2019. It is now read-only.

Commit a12bd57

Browse files
author
Brandon Philips
committed
bump(github.com/coreos/go-log/log):
1 parent ba287a6 commit a12bd57

File tree

5 files changed

+21
-29
lines changed

5 files changed

+21
-29
lines changed

third_party/github.com/coreos/go-log/log/commands.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package log
2-
// Copyright 2013, David Fisher. All rights reserved.
2+
// Copyright 2013, CoreOS, Inc. All rights reserved.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.

third_party/github.com/coreos/go-log/log/fields.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package log
2-
// Copyright 2013, David Fisher. All rights reserved.
2+
// Copyright 2013, CoreOS, Inc. All rights reserved.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.

third_party/github.com/coreos/go-log/log/logger.go

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package log
2-
// Copyright 2013, David Fisher. All rights reserved.
2+
// Copyright 2013, CoreOS, Inc. All rights reserved.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -18,10 +18,9 @@ package log
1818

1919
import (
2020
"bitbucket.org/kardianos/osext"
21-
"github.com/coreos/go-systemd/journal"
21+
"os"
2222
"path"
2323
"time"
24-
"os"
2524
)
2625

2726
// Logger is user-immutable immutable struct which can log to several outputs
@@ -69,10 +68,5 @@ func NewSimple(sinks ...Sink) *Logger {
6968
var defaultLogger *Logger
7069

7170
func init() {
72-
sinks := make([]Sink, 0)
73-
sinks = append(sinks, WriterSink(os.Stdout, BasicFormat, BasicFields))
74-
if journal.Enabled() {
75-
sinks = append(sinks, JournalSink())
76-
}
77-
defaultLogger = NewSimple(sinks...)
71+
defaultLogger = NewSimple(CombinedSink(os.Stdout, BasicFormat, BasicFields))
7872
}

third_party/github.com/coreos/go-log/log/priority.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package log
2-
// Copyright 2013, David Fisher. All rights reserved.
2+
// Copyright 2013, CoreOS, Inc. All rights reserved.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.

third_party/github.com/coreos/go-log/log/sinks.go

+15-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package log
2-
3-
// Copyright 2013, David Fisher. All rights reserved.
2+
// Copyright 2013, CoreOS, Inc. All rights reserved.
43
//
54
// Licensed under the Apache License, Version 2.0 (the "License");
65
// you may not use this file except in compliance with the License.
@@ -112,26 +111,25 @@ func JournalSink() Sink {
112111
return &journalSink{}
113112
}
114113

115-
type tryJournalSink struct {
116-
j journalSink
117-
w writerSink
114+
type combinedSink struct {
115+
sinks []Sink
118116
}
119117

120-
func (sink *tryJournalSink) Log(fields Fields) {
121-
if journal.Enabled() {
122-
sink.j.Log(fields)
123-
} else {
124-
sink.w.Log(fields)
118+
func (sink *combinedSink) Log(fields Fields) {
119+
for _, s := range sink.sinks {
120+
s.Log(fields)
125121
}
126122
}
127123

128-
func JournalFallbackSink(out io.Writer, format string, fields []string) Sink {
129-
return &tryJournalSink{
130-
w: writerSink{
131-
out: out,
132-
format: format,
133-
fields: fields,
134-
},
124+
func CombinedSink(writer io.Writer, format string, fields []string) Sink {
125+
sinks := make([]Sink, 0)
126+
sinks = append(sinks, WriterSink(writer, format, fields))
127+
if journal.Enabled() {
128+
sinks = append(sinks, JournalSink())
129+
}
130+
131+
return &combinedSink{
132+
sinks: sinks,
135133
}
136134
}
137135

0 commit comments

Comments
 (0)