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