123456789101112131415161718192021222324252627282930313233343536 |
- package logs
- import (
- "fmt"
- "github.com/astaxie/beego/logs"
- "runtime"
- "time"
- )
- var logx *logs.BeeLogger
- var Test = true
- func init() {
- logx = logs.NewLogger()
- logx.SetLogger(logs.AdapterFile, `{"filename":"logs/Mqtt/Mqtt.log"}`)
- if runtime.GOOS == "windows" {
- Test = true
- } else {
- Test = false
- }
- }
- func Println(a ...interface{}) {
- if Test {
- fmt.Println(time.Now().Format("2006-01-02 15:04:05"), "=>", a)
- }
- logx.Info(time.Now().Format("2006-01-02 15:04:05")+">", a)
- }
- //func Println(a ...interface{}) {
- // if test {
- // fmt.Printf("=>", a)
- // }
- // logx.Info(">", a)
- //}
|