vendor/github.com/spf13/jwalterweatherman/default_notepad.go
changeset 251 1c52a0eeb952
parent 242 2a9ec03fe5a1
equal deleted inserted replaced
250:c040f992052f 251:1c52a0eeb952
    62 func SetStdoutThreshold(threshold Threshold) {
    62 func SetStdoutThreshold(threshold Threshold) {
    63 	defaultNotepad.SetStdoutThreshold(threshold)
    63 	defaultNotepad.SetStdoutThreshold(threshold)
    64 	reloadDefaultNotepad()
    64 	reloadDefaultNotepad()
    65 }
    65 }
    66 
    66 
       
    67 // SetStdoutOutput set the stdout output for the default notepad. Default is stdout.
       
    68 func SetStdoutOutput(handle io.Writer) {
       
    69 	defaultNotepad.outHandle = handle
       
    70 	defaultNotepad.init()
       
    71 	reloadDefaultNotepad()
       
    72 }
       
    73 
    67 // SetPrefix set the prefix for the default logger. Empty by default.
    74 // SetPrefix set the prefix for the default logger. Empty by default.
    68 func SetPrefix(prefix string) {
    75 func SetPrefix(prefix string) {
    69 	defaultNotepad.SetPrefix(prefix)
    76 	defaultNotepad.SetPrefix(prefix)
    70 	reloadDefaultNotepad()
    77 	reloadDefaultNotepad()
    71 }
    78 }
    72 
    79 
    73 // SetFlags set the flags for the default logger. "log.Ldate | log.Ltime" by default.
    80 // SetFlags set the flags for the default logger. "log.Ldate | log.Ltime" by default.
    74 func SetFlags(flags int) {
    81 func SetFlags(flags int) {
    75 	defaultNotepad.SetFlags(flags)
    82 	defaultNotepad.SetFlags(flags)
       
    83 	reloadDefaultNotepad()
       
    84 }
       
    85 
       
    86 // SetLogListeners configures the default logger with one or more log listeners.
       
    87 func SetLogListeners(l ...LogListener) {
       
    88 	defaultNotepad.logListeners = l
       
    89 	defaultNotepad.init()
    76 	reloadDefaultNotepad()
    90 	reloadDefaultNotepad()
    77 }
    91 }
    78 
    92 
    79 // Level returns the current global log threshold.
    93 // Level returns the current global log threshold.
    80 func LogThreshold() Threshold {
    94 func LogThreshold() Threshold {
    93 
   107 
    94 // GetStdoutThreshold returns the Treshold for the stdout logger.
   108 // GetStdoutThreshold returns the Treshold for the stdout logger.
    95 func GetStdoutThreshold() Threshold {
   109 func GetStdoutThreshold() Threshold {
    96 	return defaultNotepad.GetStdoutThreshold()
   110 	return defaultNotepad.GetStdoutThreshold()
    97 }
   111 }
    98 
       
    99 // LogCountForLevel returns the number of log invocations for a given threshold.
       
   100 func LogCountForLevel(l Threshold) uint64 {
       
   101 	return defaultNotepad.LogCountForLevel(l)
       
   102 }
       
   103 
       
   104 // LogCountForLevelsGreaterThanorEqualTo returns the number of log invocations
       
   105 // greater than or equal to a given threshold.
       
   106 func LogCountForLevelsGreaterThanorEqualTo(threshold Threshold) uint64 {
       
   107 	return defaultNotepad.LogCountForLevelsGreaterThanorEqualTo(threshold)
       
   108 }
       
   109 
       
   110 // ResetLogCounters resets the invocation counters for all levels.
       
   111 func ResetLogCounters() {
       
   112 	defaultNotepad.ResetLogCounters()
       
   113 }