diff --git a/logging/log.go b/logging/log.go index 6e8a7bd..f43d94e 100644 --- a/logging/log.go +++ b/logging/log.go @@ -287,6 +287,39 @@ func NewMulti(loggers ...Logger) *Multi { return &Multi{loggers: loggers} } +func (m *Multi) SetLevel(level Level) { + for _, l := range m.loggers { + l.SetLevel(level) + } +} + +func (m *Multi) Good() bool { + good := true + for _, l := range m.loggers { + good = good && l.Good() + } + + return good +} + +func (m *Multi) Status() error { + for _, l := range m.loggers { + if err := l.Status(); err != nil { + return err + } + } + + return nil +} + +func (m *Multi) Close() error { + for _, l := range m.loggers { + l.Close() + } + + return nil +} + func (m *Multi) Debug(actor, event string, attrs map[string]string) { for _, l := range m.loggers { l.Debug(actor, event, attrs) diff --git a/logging/log_test.go b/logging/log_test.go index 49cfa32..4a26765 100644 --- a/logging/log_test.go +++ b/logging/log_test.go @@ -53,3 +53,12 @@ func TestDestroyLogFiles(t *testing.T) { os.Remove("fw2.log") os.Remove("fw2.err") } + +func TestMulti(t *testing.T) { + c1 := NewConsole() + c2 := NewConsole() + m := NewMulti(c1, c2) + if !m.Good() { + t.Fatal("failed to set up multi logger") + } +}