Documentation ¶
Index ¶
- Variables
- func SetFlags(flags int)
- func SetLogListeners(l ...LogListener)
- func SetLogOutput(handle io.Writer)
- func SetLogThreshold(threshold Threshold)
- func SetPrefix(prefix string)
- func SetStdoutOutput(handle io.Writer)
- func SetStdoutThreshold(threshold Threshold)
- type Counter
- type Feedback
- type LogListener
- type Notepad
- func (n *Notepad) GetLogThreshold() Threshold
- func (n *Notepad) GetStdoutThreshold() Threshold
- func (n *Notepad) SetFlags(flags int)
- func (n *Notepad) SetLogOutput(handle io.Writer)
- func (n *Notepad) SetLogThreshold(threshold Threshold)
- func (n *Notepad) SetPrefix(prefix string)
- func (n *Notepad) SetStdoutThreshold(threshold Threshold)
- type Threshold
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func SetFlags ¶
func SetFlags(flags int)
SetFlags set the flags for the default logger. "log.Ldate | log.Ltime" by default.
func SetLogListeners ¶ added in v1.1.0
func SetLogListeners(l ...LogListener)
SetLogListeners configures the default logger with one or more log listeners.
func SetLogOutput ¶
SetLogOutput set the log output for the default notepad. Discarded by default.
func SetLogThreshold ¶
func SetLogThreshold(threshold Threshold)
SetLogThreshold set the log threshold for the default notepad. Trace by default.
func SetPrefix ¶
func SetPrefix(prefix string)
SetPrefix set the prefix for the default logger. Empty by default.
func SetStdoutOutput ¶ added in v1.1.0
SetStdoutOutput set the stdout output for the default notepad. Default is stdout.
func SetStdoutThreshold ¶
func SetStdoutThreshold(threshold Threshold)
SetStdoutThreshold set the standard output threshold for the default notepad. Info by default.
Types ¶
type Counter ¶ added in v1.1.0
type Counter struct {
// contains filtered or unexported fields
}
Counter is an io.Writer that increments a counter on Write.
type Feedback ¶
type Feedback struct {
// contains filtered or unexported fields
}
Feedback writes plainly to the outHandle while logging with the standard extra information (date, file, etc).
type LogListener ¶ added in v1.1.0
A LogListener can ble supplied to a Notepad to listen on log writes for a given threshold. This can be used to capture log events in unit tests and similar. Note that this function will be invoked once for each log threshold. If the given threshold is not of interest to you, return nil. Note that these listeners will receive log events for a given threshold, even if the current configuration says not to log it. That way you can count ERRORs even if you don't print them to the console.
func LogCounter ¶ added in v1.1.0
func LogCounter(counter *Counter, t1 Threshold) LogListener
LogCounter creates a LogListener that counts log statements >= the given threshold.
type Notepad ¶
type Notepad struct { TRACE *log.Logger DEBUG *log.Logger INFO *log.Logger WARN *log.Logger ERROR *log.Logger CRITICAL *log.Logger FATAL *log.Logger LOG *log.Logger FEEDBACK *Feedback // contains filtered or unexported fields }
Notepad is where you leave a note!
func NewNotepad ¶
func NewNotepad( outThreshold Threshold, logThreshold Threshold, outHandle, logHandle io.Writer, prefix string, flags int, logListeners ...LogListener, ) *Notepad
NewNotepad creates a new Notepad.
func (*Notepad) GetLogThreshold ¶
GetStdoutThreshold returns the defined Treshold for the log logger.
func (*Notepad) GetStdoutThreshold ¶
GetStdoutThreshold returns the Treshold for the stdout logger.
func (*Notepad) SetFlags ¶
SetFlags choose which flags the logger will display (after prefix and message level). See the package log for more informations on this.
func (*Notepad) SetLogOutput ¶
SetLogOutput changes the file where log messages are written.
func (*Notepad) SetLogThreshold ¶
SetLogThreshold changes the threshold above which messages are written to the log file.
func (*Notepad) SetPrefix ¶
SetPrefix changes the prefix used by the notepad. Prefixes are displayed between brackets at the beginning of the line. An empty prefix won't be displayed at all.
func (*Notepad) SetStdoutThreshold ¶
SetStdoutThreshold changes the threshold above which messages are written to the standard output.
type Threshold ¶
type Threshold int
func GetLogThreshold ¶
func GetLogThreshold() Threshold
GetStdoutThreshold returns the defined Treshold for the log logger.
func GetStdoutThreshold ¶
func GetStdoutThreshold() Threshold
GetStdoutThreshold returns the Treshold for the stdout logger.
func StdoutThreshold ¶
func StdoutThreshold() Threshold
Level returns the current global output threshold.