Documentation ¶
Overview ¶
Package noplog implements a noop logger with a null writer.
The writer implements the io.Write interface but does not do anything. All logging function definitions are empty noops.
Common use:
// Initialize the package. func init() { // Set the random seed to something different each time. // This is very common in init rand.Seed(time.Now().Unix()) // Stop the grpc verbose logging grpclog.SetLogger(noplog.New()) }
This functionality exists because some third party packages (looking at you, grpc) have internal logging that may interfere with primary application logging. The noplog can be passed to those libraries, allowing you to stifle those log messages in favor of your application logs.
Index ¶
- type NopLogger
- func (l *NopLogger) Fatal(args ...interface{})
- func (l *NopLogger) Fatalf(format string, args ...interface{})
- func (l *NopLogger) Fatalln(args ...interface{})
- func (l *NopLogger) Print(args ...interface{})
- func (l *NopLogger) Printf(format string, args ...interface{})
- func (l *NopLogger) Println(v ...interface{})
- type NullWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NopLogger ¶
NopLogger is a noop logger for passing to grpclog to minimize spew.
func New ¶
func New() *NopLogger
New returns a NopLogger that sets the log module to write to a null writer, thereby ensuring that logging is a noop for any package that uses the logger.
type NullWriter ¶
type NullWriter int
NullWriter implements the io.Write interface but doesn't do anything.