Documentation
¶
Overview ¶
Package logs provides a simple logging interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Log ¶
type Log func(Message)
Log is a function that logs a message.
var Discard Log
Discard is a log that discards all messages.
Terse is a log that prints non-verbose messages to STDOUT.
Verbose is a log that prints all messages to STDOUT.
func (Log) WithPrefix ¶
WithPrefix returns a log that prefixes all messages with the given string.
func (Log) WriteVerbose ¶
WriteVerbose writes a log message that is only shown if verbose logging is enabled.
type Writer ¶
type Writer struct { // Target is the log that receives the log messages. Target Log // contains filtered or unexported fields }
Writer is an adaptor that presents a Logger as an io.WriteCloser.
Each line of text written via Write() is logged as a separate message. Any call to write with text that does not end in line separator is buffered until a line separator is written or Close() is called. Blank lines are ignored.
Any instance of a LF, CR or CRLF is treated as a line separator. This allows usage with Unix-style or Windows-style text output, as well as console output that uses CR to overwrite the current line.