Documentation ¶
Overview ¶
Package log provides a simple wrapper around the standard Go library's 'log' package, combining concepts from two of Dave Cheney's blog posts:
- http://dave.cheney.net/2014/09/28/using-build-to-switch-between-debug-and-release
- http://dave.cheney.net/2015/11/05/lets-talk-about-logging
In particular, it exposes only the log.Print* functions, and adds an additional set of log.Debug* functions, which in turn call their log.Print* counterparts only when the 'debug' build tag is present.
Index ¶
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Debugln(v ...interface{})
- func Flags() int
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- type Logger
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Debugf(format string, v ...interface{})
- func (l *Logger) Debugln(v ...interface{})
- func (l *Logger) Flags() int
- func (l *Logger) Print(v ...interface{})
- func (l *Logger) Printf(format string, v ...interface{})
- func (l *Logger) Println(v ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(v ...interface{})
Debug calls log.Print() only when the 'debug' build flag is present.
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf calls log.Printf() only when the 'debug' build flag is present.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
A Logger represents an active logging object that generates lines of output to an io.Writer. Each logging operation makes a single call to the Writer's Write method. A Logger can be used simultaneously from multiple goroutines; it guarantees to serialize access to the Writer.
func (*Logger) Debug ¶
func (l *Logger) Debug(v ...interface{})
Debug calls log.Print() only when the 'debug' build flag is present.
func (*Logger) Debugln ¶
func (l *Logger) Debugln(v ...interface{})
Debugln calls log.Println() only when the 'debug' build flag is present.