This commit is contained in:
Liang Ding 2014-12-16 15:54:53 +08:00
parent 27ae6f2013
commit 2d3791bdb9
2 changed files with 11 additions and 1 deletions

View File

@ -118,11 +118,21 @@ func (l *Logger) Tracef(format string, v ...interface{}) {
l.logger.Output(2, fmt.Sprintf(format, v...)) l.logger.Output(2, fmt.Sprintf(format, v...))
} }
// IsTraceEnabled determines whether the trace level is enabled.
func (l *Logger) IsTraceEnabled() bool {
return l.level <= Trace
}
// IsDebugEnabled determines whether the debug level is enabled. // IsDebugEnabled determines whether the debug level is enabled.
func (l *Logger) IsDebugEnabled() bool { func (l *Logger) IsDebugEnabled() bool {
return l.level <= Debug return l.level <= Debug
} }
// IsWarnEnabled determines whether the debug level is enabled.
func (l *Logger) IsWarnEnabled() bool {
return l.level <= Warn
}
// Debug prints debug level message. // Debug prints debug level message.
func (l *Logger) Debug(v ...interface{}) { func (l *Logger) Debug(v ...interface{}) {
if Debug < l.level { if Debug < l.level {

View File

@ -171,7 +171,7 @@ func LoginHandler(w http.ResponseWriter, r *http.Request) {
}{} }{}
if err := json.NewDecoder(r.Body).Decode(&args); err != nil { if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err) logger.Error("login error: ", err)
succ = false succ = false
return return