Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix golint #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions default_notepad.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"os"
)

// easy to use
var (
TRACE *log.Logger
DEBUG *log.Logger
Expand Down Expand Up @@ -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()
}
Expand Down
11 changes: 9 additions & 2 deletions notepad.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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...))
}
Expand Down