Skip to content

Files

Latest commit

78bca50 · Oct 24, 2019

History

History

noplog

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Oct 24, 2019
Oct 24, 2019

Noplog

A noop logger for capturing internal logging.

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.

Usage:

// 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())
}

Note that the init() function is run to initialize the package after all variable definitions have been set but before the main function is executed.