dd9309c15e
Initial vendor list validated with empty $GOPATH and only master checked out; followed by `make` and verified that all binaries build properly. Updates require github.com/LK4D4/vndr tool. Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
// Copyright 2012-2014 Apcera Inc. All rights reserved.
|
|
package logger
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
type SysLogger struct {
|
|
writer *log.Logger
|
|
debug bool
|
|
trace bool
|
|
}
|
|
|
|
func NewSysLogger(debug, trace bool) *SysLogger {
|
|
w := log.New(os.Stdout, "gnatsd", log.LstdFlags)
|
|
|
|
return &SysLogger{
|
|
writer: w,
|
|
debug: debug,
|
|
trace: trace,
|
|
}
|
|
}
|
|
|
|
func NewRemoteSysLogger(fqn string, debug, trace bool) *SysLogger {
|
|
return NewSysLogger(debug, trace)
|
|
}
|
|
|
|
func (l *SysLogger) Noticef(format string, v ...interface{}) {
|
|
l.writer.Println("NOTICE", fmt.Sprintf(format, v...))
|
|
}
|
|
|
|
func (l *SysLogger) Fatalf(format string, v ...interface{}) {
|
|
l.writer.Println("CRITICAL", fmt.Sprintf(format, v...))
|
|
}
|
|
|
|
func (l *SysLogger) Errorf(format string, v ...interface{}) {
|
|
l.writer.Println("ERROR", fmt.Sprintf(format, v...))
|
|
}
|
|
|
|
func (l *SysLogger) Debugf(format string, v ...interface{}) {
|
|
if l.debug {
|
|
l.writer.Println("DEBUG", fmt.Sprintf(format, v...))
|
|
}
|
|
}
|
|
|
|
func (l *SysLogger) Tracef(format string, v ...interface{}) {
|
|
if l.trace {
|
|
l.writer.Println("NOTICE", fmt.Sprintf(format, v...))
|
|
}
|
|
}
|