This commit is contained in:
parent
abfd4ad782
commit
7997393521
10
log/logs.go
10
log/logs.go
|
@ -17,6 +17,7 @@
|
|||
// log.Level = log.Debug
|
||||
// logger := log.NewLogger(os.Stdout)
|
||||
//
|
||||
// logger.Trace("trace message)
|
||||
// logger.Debug("debug message")
|
||||
// logger.Info("info message")
|
||||
// logger.Warn("warning message")
|
||||
|
@ -34,7 +35,8 @@ import (
|
|||
|
||||
// Logging level.
|
||||
const (
|
||||
Debug = iota
|
||||
Trace = iota
|
||||
Debug
|
||||
Info
|
||||
Warn
|
||||
Error
|
||||
|
@ -76,6 +78,8 @@ func getLevel(level string) int {
|
|||
level = strings.ToLower(level)
|
||||
|
||||
switch level {
|
||||
case "trace":
|
||||
return Trace
|
||||
case "debug":
|
||||
return Debug
|
||||
case "info":
|
||||
|
@ -96,7 +100,7 @@ func (l *Logger) SetLevel(level string) {
|
|||
|
||||
// Trace prints trace level message.
|
||||
func (l *Logger) Trace(v ...interface{}) {
|
||||
if Debug < l.level {
|
||||
if Trace < l.level {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -106,7 +110,7 @@ func (l *Logger) Trace(v ...interface{}) {
|
|||
|
||||
// Tracef prints trace level message with format.
|
||||
func (l *Logger) Tracef(format string, v ...interface{}) {
|
||||
if Debug < l.level {
|
||||
if Trace < l.level {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
2
main.go
2
main.go
|
@ -50,7 +50,7 @@ func init() {
|
|||
confIP := flag.String("ip", "", "ip to visit")
|
||||
confPort := flag.String("port", "", "port to visit")
|
||||
confServer := flag.String("server", "", "this will overwrite Wide.Server if specified")
|
||||
confLogLevel := flag.String("log_level", "info", "logging level: debug/info/warn/error")
|
||||
confLogLevel := flag.String("log_level", "info", "logging level: trace/debug/info/warn/error")
|
||||
confStaticServer := flag.String("static_server", "", "this will overwrite Wide.StaticServer if specified")
|
||||
confContext := flag.String("context", "", "this will overwrite Wide.Context if specified")
|
||||
confChannel := flag.String("channel", "", "this will overwrite Wide.XXXChannel if specified")
|
||||
|
|
Loading…
Reference in New Issue