-
Notifications
You must be signed in to change notification settings - Fork 4
/
GoLogObj.go
42 lines (37 loc) · 1.05 KB
/
GoLogObj.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* reference:
* - [golang time的几种用法](https://my.oschina.net/yinlei212/blog/151963)
*/
package main
import (
"sync"
"strings"
"github.com/TarsCloud/TarsGo/tars"
"github.com/TarsCloud/TarsGo/tars/util/rogger"
log "./Logf"
logClient "../GoLogger/log"
)
type GoLogObj struct {}
var once sync.Once
var llog *rogger.Logger
func init() {
llog = tars.GetLogger("remote_logs")
return
}
func (imp *GoLogObj) LoggerbyInfo(logConf *log.LogInfo, logList []string) error {
for _, each_log := range logList {
seperator := strings.Index(each_log, "|") + 1
log_msg, _ := logClient.ParseLogText(each_log[seperator:])
if strings.Count(log_msg.Datetime, "") > 0 {
llog.Infof(" - %s.%s <%s> | %s | %s:%d | %s() | %s | %s",
logConf.Appname, logConf.Servername, logConf.SFilename,
log_msg.Datetime, log_msg.File, int(log_msg.Line), log_msg.Function,
log_msg.LevelStr, log_msg.Text)
}
}
return nil
};
func (imp *GoLogObj) Logger(app string, server string, file string, format string, buffer []string) error {
llog.Info("MARK")
return nil
}