diff --git a/default_notepad.go b/default_notepad.go index a018c15..8a439ce 100644 --- a/default_notepad.go +++ b/default_notepad.go @@ -12,6 +12,7 @@ import ( "os" ) +// easy to use var ( TRACE *log.Logger DEBUG *log.Logger @@ -90,17 +91,17 @@ func SetLogListeners(l ...LogListener) { reloadDefaultNotepad() } -// Level returns the current global log threshold. +// LogThreshold returns the current global log threshold. func LogThreshold() Threshold { return defaultNotepad.logThreshold } -// Level returns the current global output threshold. +// StdoutThreshold returns the current global output threshold. func StdoutThreshold() Threshold { return defaultNotepad.stdoutThreshold } -// GetStdoutThreshold returns the defined Treshold for the log logger. +// GetLogThreshold returns the defined Treshold for the log logger. func GetLogThreshold() Threshold { return defaultNotepad.GetLogThreshold() } diff --git a/notepad.go b/notepad.go index cc7957b..14bb2ae 100644 --- a/notepad.go +++ b/notepad.go @@ -12,12 +12,14 @@ import ( "log" ) +// Threshold specified the log level type Threshold int func (t Threshold) String() string { return prefixes[t] } +// define log level const ( LevelTrace Threshold = iota LevelDebug @@ -28,7 +30,7 @@ const ( LevelFatal ) -var prefixes map[Threshold]string = map[Threshold]string{ +var prefixes = map[Threshold]string{ LevelTrace: "TRACE", LevelDebug: "DEBUG", LevelInfo: "INFO", @@ -161,7 +163,7 @@ func (n *Notepad) SetLogOutput(handle io.Writer) { n.init() } -// GetStdoutThreshold returns the defined Treshold for the log logger. +// GetLogThreshold returns the defined Treshold for the log logger. func (n *Notepad) GetLogThreshold() Threshold { return n.logThreshold } @@ -203,14 +205,19 @@ type Feedback struct { log *log.Logger } +// Println formats using the default formats for its operands and writes to output. +// Spaces are always added between operands and a newline is appended. func (fb *Feedback) Println(v ...interface{}) { fb.output(fmt.Sprintln(v...)) } +// Printf formats according to a format specifier and writes to output. func (fb *Feedback) Printf(format string, v ...interface{}) { fb.output(fmt.Sprintf(format, v...)) } +// Print formats using the default formats for its operands and writes to output. +// Spaces are added between operands when neither is a string. func (fb *Feedback) Print(v ...interface{}) { fb.output(fmt.Sprint(v...)) }