set stacklevel

This commit is contained in:
jackdaw 2016-11-09 11:58:55 +09:00
parent 9818da5c38
commit 1d48dfc68b

81
log.go
View File

@ -1,77 +1,77 @@
package log package log
import ( import (
"fmt" "fmt"
"github.com/cihub/seelog" "github.com/cihub/seelog"
) )
//var logger seelog.LoggerInterface //var logger seelog.LoggerInterface
func LoadLogConfig(path string) error { func LoadLogConfig(path string) error {
//pwd, _ := os.Getwd() //pwd, _ := os.Getwd()
//path := pwd+"/src/loafle.com/overflow/collector/log/seelogconfig.xml" //path := pwd+"/src/loafle.com/overflow/collector/log/seelogconfig.xml"
//var err error //var err error
logger, err := seelog.LoggerFromConfigAsFile(path) logger, err := seelog.LoggerFromConfigAsFile(path)
if err != nil { if err != nil {
fmt.Println("Error : ", err) fmt.Println("Error : ", err)
return err return err
} }
seelog.ReplaceLogger(logger) seelog.ReplaceLogger(logger)
seelog.Current.SetAdditionalStackDepth(1)
return err return err
} }
func Debugf(format string, params ...interface{}) { func Debugf(format string, params ...interface{}) {
seelog.Debugf(format, params) seelog.Debugf(format, params)
} }
func Tracef(format string, params ...interface{}) { func Tracef(format string, params ...interface{}) {
seelog.Tracef(format, params) seelog.Tracef(format, params)
} }
func Warnf(format string, params ...interface{}) { func Warnf(format string, params ...interface{}) {
seelog.Warnf(format, params) seelog.Warnf(format, params)
} }
func Infof(format string, params ...interface{}) { func Infof(format string, params ...interface{}) {
seelog.Infof(format, params) seelog.Infof(format, params)
} }
func Errorf(format string, params ...interface{}) { func Errorf(format string, params ...interface{}) {
seelog.Errorf(format, params) seelog.Errorf(format, params)
} }
func Criticalf(format string, params ...interface{}) { func Criticalf(format string, params ...interface{}) {
seelog.Criticalf(format, params) seelog.Criticalf(format, params)
} }
//func Fatalf(format string, params ...interface{}) { //func Fatalf(format string, params ...interface{}) {
// seelog.Criticalf(format, params) // seelog.Criticalf(format, params)
// os.Exit(1) // os.Exit(1)
//} //}
func Debug(v ...interface{}) { func Debug(v ...interface{}) {
seelog.Debug(v) seelog.Debug(v)
} }
func Trace(v ...interface{}) { func Trace(v ...interface{}) {
seelog.Trace(v) seelog.Trace(v)
} }
func Warn(v ...interface{}) { func Warn(v ...interface{}) {
seelog.Warn(v) seelog.Warn(v)
} }
func Info(v ...interface{}) { func Info(v ...interface{}) {
seelog.Info(v) seelog.Info(v)
} }
func Error(v ...interface{}) { func Error(v ...interface{}) {
seelog.Error(v) seelog.Error(v)
} }
func Critical(v ...interface{}) { func Critical(v ...interface{}) {
seelog.Critical(v) seelog.Critical(v)
} }
//func Fatal(v ...interface{}) { //func Fatal(v ...interface{}) {
@ -79,7 +79,6 @@ func Critical(v ...interface{}) {
// os.Exit(1) // os.Exit(1)
//} //}
func Flush() { func Flush() {
seelog.Flush() seelog.Flush()
} }