12345678910111213141516171819202122232425262728293031323334353637383940 |
- package logs
- import (
- "fmt"
- "github.com/astaxie/beego/logs"
- "runtime"
- )
- var Test = true
- var logx *logs.BeeLogger
- var logxE *logs.BeeLogger
- func init() {
- if runtime.GOOS == "windows" {
- Test = true
- } else {
- Test = false
- }
- logx = logs.NewLogger()
- logx.SetLogger(logs.AdapterFile, `{"filename":"logs/logx/logx.log"}`)
- logxE = logs.NewLogger()
- logxE.SetLogger(logs.AdapterFile, `{"filename":"logs/logxE/logx.log"}`)
- }
- func Println(format string, v ...interface{}) {
- if Test{fmt.Println(format, v)}
- logx.Info(format, v)
- }
- func PrintlnError(format string, v ...interface{}) {
- if Test{fmt.Println(format, v)}
- logxE.Error(format, v)
- logx.Info(format, v)
- }
|