Add getters for the tresholds
diff --git a/default_notepad.go b/default_notepad.go index e2293f4..bcb7634 100644 --- a/default_notepad.go +++ b/default_notepad.go
@@ -86,6 +86,16 @@ return defaultNotepad.stdoutThreshold } +// GetStdoutThreshold returns the defined Treshold for the log logger. +func GetLogThreshold() Threshold { + return defaultNotepad.GetLogThreshold() +} + +// GetStdoutThreshold returns the Treshold for the stdout logger. +func GetStdoutThreshold() Threshold { + return defaultNotepad.GetStdoutThreshold() +} + // LogCountForLevel returns the number of log invocations for a given threshold. func LogCountForLevel(l Threshold) uint64 { return defaultNotepad.LogCountForLevel(l)
diff --git a/notepad.go b/notepad.go index a35d7a8..5a623f4 100644 --- a/notepad.go +++ b/notepad.go
@@ -141,6 +141,11 @@ n.init() } +// GetStdoutThreshold returns the defined Treshold for the log logger. +func (n *Notepad) GetLogThreshold() Threshold { + return n.logThreshold +} + // SetStdoutThreshold change the threshold above which messages are written to the // standard output func (n *Notepad) SetStdoutThreshold(threshold Threshold) { @@ -148,6 +153,11 @@ n.init() } +// GetStdoutThreshold returns the Treshold for the stdout logger. +func (n *Notepad) GetStdoutThreshold() Threshold { + return n.stdoutThreshold +} + // SetPrefix change the prefix used by the notepad. Prefixes are displayed between // brackets at the begining of the line. An empty prefix won't be displayed at all. func (n *Notepad) SetPrefix(prefix string) {
diff --git a/notepad_test.go b/notepad_test.go index 66a3cf4..d0e3ab0 100644 --- a/notepad_test.go +++ b/notepad_test.go
@@ -18,6 +18,9 @@ n := NewNotepad(LevelCritical, LevelError, &outHandle, &logHandle, "TestNotePad", 0) + require.Equal(t, LevelCritical, n.GetStdoutThreshold()) + require.Equal(t, LevelError, n.GetLogThreshold()) + n.DEBUG.Println("Some debug") n.ERROR.Println("Some error") n.CRITICAL.Println("Some critical error")