f60e44afc7
Adds nomad monitor command. Like consul monitor, this command allows you to stream logs from a nomad agent in real time with a a specified log level add endpoint tests Upgrade go-hclog to latest version The current version of go-hclog pads log prefixes to equal lengths so info becomes [INFO ] and debug becomes [DEBUG]. This breaks hashicorp/logutils/level.go Check function. Upgrading to the latest version removes this padding and fixes log filtering that uses logutils Check
53 lines
1.3 KiB
Go
53 lines
1.3 KiB
Go
package hclog
|
|
|
|
import (
|
|
"io"
|
|
"io/ioutil"
|
|
"log"
|
|
)
|
|
|
|
// NewNullLogger instantiates a Logger for which all calls
|
|
// will succeed without doing anything.
|
|
// Useful for testing purposes.
|
|
func NewNullLogger() Logger {
|
|
return &nullLogger{}
|
|
}
|
|
|
|
type nullLogger struct{}
|
|
|
|
func (l *nullLogger) Trace(msg string, args ...interface{}) {}
|
|
|
|
func (l *nullLogger) Debug(msg string, args ...interface{}) {}
|
|
|
|
func (l *nullLogger) Info(msg string, args ...interface{}) {}
|
|
|
|
func (l *nullLogger) Warn(msg string, args ...interface{}) {}
|
|
|
|
func (l *nullLogger) Error(msg string, args ...interface{}) {}
|
|
|
|
func (l *nullLogger) IsTrace() bool { return false }
|
|
|
|
func (l *nullLogger) IsDebug() bool { return false }
|
|
|
|
func (l *nullLogger) IsInfo() bool { return false }
|
|
|
|
func (l *nullLogger) IsWarn() bool { return false }
|
|
|
|
func (l *nullLogger) IsError() bool { return false }
|
|
|
|
func (l *nullLogger) With(args ...interface{}) Logger { return l }
|
|
|
|
func (l *nullLogger) Named(name string) Logger { return l }
|
|
|
|
func (l *nullLogger) ResetNamed(name string) Logger { return l }
|
|
|
|
func (l *nullLogger) SetLevel(level Level) {}
|
|
|
|
func (l *nullLogger) StandardLogger(opts *StandardLoggerOptions) *log.Logger {
|
|
return log.New(l.StandardWriter(opts), "", log.LstdFlags)
|
|
}
|
|
|
|
func (l *nullLogger) StandardWriter(opts *StandardLoggerOptions) io.Writer {
|
|
return ioutil.Discard
|
|
}
|