Files
nats-server/server/log_test.go
Ken Robertson 5623b583a9 Updates for new logging to appease govet
Govet doesn't like functions that look like format handlers not ending in `f`,
such as Debug() vs Debugf(). This is changing some of the new log handling to
use 'f' function names to appease govet.

Updated the implicit handling of including the client as an arg without being
used in a format string. Now the client object simply has a Errorf function
for logging errors and it adds itself onto the format string.
2014-10-29 11:32:14 -07:00

32 lines
805 B
Go

// Copyright 2014 Apcera Inc. All rights reserved.
package server
import (
"testing"
)
func TestSetLogger(t *testing.T) {
server := &Server{}
server.SetLogger(&DummyLogger{}, true, true)
// We assert that the logger has change to the DummyLogger
_ = log.logger.(*DummyLogger)
if debug != 1 {
t.Fatalf("Expected debug 1, received value %d\n", debug)
}
if trace != 1 {
t.Fatalf("Expected trace 1, received value %d\n", trace)
}
}
type DummyLogger struct{}
func (l *DummyLogger) Noticef(format string, v ...interface{}) {}
func (l *DummyLogger) Errorf(format string, v ...interface{}) {}
func (l *DummyLogger) Fatalf(format string, v ...interface{}) {}
func (l *DummyLogger) Debugf(format string, v ...interface{}) {}
func (l *DummyLogger) Tracef(format string, v ...interface{}) {}