logging
This commit is contained in:
parent
27ae6f2013
commit
2d3791bdb9
10
log/logs.go
10
log/logs.go
|
@ -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 {
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue