mirror of
https://github.com/astaxie/beego.git
synced 2025-06-12 12:00:39 +00:00
fix issue #1566
This commit is contained in:
@ -48,16 +48,16 @@ func (el *esLogger) Init(jsonconfig string) error {
|
||||
}
|
||||
|
||||
// WriteMsg will write the msg and level into es
|
||||
func (el *esLogger) WriteMsg(msg string, level int) error {
|
||||
func (el *esLogger) WriteMsg(when time.Time, msg string, level int) error {
|
||||
if level > el.Level {
|
||||
return nil
|
||||
}
|
||||
t := time.Now()
|
||||
|
||||
vals := make(map[string]interface{})
|
||||
vals["@timestamp"] = t.Format(time.RFC3339)
|
||||
vals["@timestamp"] = when.Format(time.RFC3339)
|
||||
vals["@msg"] = msg
|
||||
d := goes.Document{
|
||||
Index: fmt.Sprintf("%04d.%02d.%02d", t.Year(), t.Month(), t.Day()),
|
||||
Index: fmt.Sprintf("%04d.%02d.%02d", when.Year(), when.Month(), when.Day()),
|
||||
Type: "logs",
|
||||
Fields: vals,
|
||||
}
|
||||
|
Reference in New Issue
Block a user