Documentation ¶
Overview ¶
Package log implements a simple replacement for the standard go log package. It provides 3 predefined loggers DEBUG, INFO and ERROR and supports the standard go context.Context to include context specific information in every logstatement
Index ¶
- Variables
- func Debug(ctx context.Context, v ...interface{})
- func Debugf(ctx context.Context, format string, v ...interface{})
- func Error(ctx context.Context, v ...interface{})
- func Errorf(ctx context.Context, format string, v ...interface{})
- func Info(ctx context.Context, v ...interface{})
- func Infof(ctx context.Context, format string, v ...interface{})
- func Warn(ctx context.Context, v ...interface{})
- func Warnf(ctx context.Context, format string, v ...interface{})
- type Logger
Constants ¶
This section is empty.
Variables ¶
var StdDebug = New(os.Stderr, newWriteMessageFunc("DEBUG"))
StdDebug is the standard logger for debug messages
var StdError = New(os.Stderr, newWriteMessageFunc("ERROR"))
StdError is the standard logger for error messages
var StdInfo = New(os.Stderr, newWriteMessageFunc("INFO"))
StdInfo is the standard logger for info messages
var StdWarn = New(os.Stderr, newWriteMessageFunc("WARN"))
StdWarn is the standard logger for warn messages
Functions ¶
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func New ¶
func New(out io.Writer, writeMessage ...func(ctx context.Context, buf []byte, message string) []byte) *Logger
New creates an new Logger. The out variable determines the destination for logstatements. The writeMessage variable determines callback functions which are invoked in the given order when writing the logstatement.
func (*Logger) Print ¶
Print writes v to the log. Arguments are handled in the same manner as fmt.Print.
func (*Logger) Printf ¶
Print writes v to the log. Arguments are handled in the same manner as fmt.Printf.
Directories ¶
Path | Synopsis |
---|---|
Package syslog provides an io.Writer for a syslog server and WriteMessageFunctions which produce RFC5424 (https://tools.ietf.org/html/rfc5424) compliant logmessages
|
Package syslog provides an io.Writer for a syslog server and WriteMessageFunctions which produce RFC5424 (https://tools.ietf.org/html/rfc5424) compliant logmessages |