From 7997393521b5a326b3554ca151e507911f54de27 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 14 Dec 2014 23:16:11 +0800 Subject: [PATCH] . --- log/logs.go | 10 +++++++--- main.go | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/log/logs.go b/log/logs.go index d1f7e75..f6001d3 100755 --- a/log/logs.go +++ b/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 } diff --git a/main.go b/main.go index 77b7018..ed94dfe 100644 --- a/main.go +++ b/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")