Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Included stack traces.

  • Loading branch information...
commit 126b36f81d1126f370034c40d44eaf19a4efcdaa 1 parent f62272f
@paddyforan paddyforan authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 log.go
View
6 log.go
@@ -4,6 +4,7 @@ import (
"io/ioutil"
"log"
"os"
+ "runtime/debug"
)
type Log struct {
@@ -22,18 +23,21 @@ const (
func (l *Log) Debug(format string, v ...interface{}) {
if l.logLevel <= LogLevelDebug {
l.logger.Printf(format, v...)
+ l.logger.Println(string(debug.Stack()))
}
}
func (l *Log) Warn(format string, v ...interface{}) {
if l.logLevel <= LogLevelWarn {
l.logger.Printf(format, v...)
+ l.logger.Println(string(debug.Stack()))
}
}
func (l *Log) Error(format string, v ...interface{}) {
if l.logLevel <= LogLevelError {
l.logger.Printf(format, v...)
+ l.logger.Println(string(debug.Stack()))
}
}
@@ -43,7 +47,7 @@ func (l *Log) SetLogLevel(level logLevel) {
func StdOutLogger(level logLevel) *Log {
return &Log{
- logger: log.New(os.Stdout, "2cloud", log.LstdFlags|log.Llongfile),
+ logger: log.New(os.Stdout, "2cloud", log.LstdFlags),
logLevel: level,
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.