forked from p93542168/wheat-cache
commit
b168eecbb4
|
@ -11,7 +11,12 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
floor = 3
|
||||||
|
)
|
||||||
|
|
||||||
func With(ctx context.Context, p event.ProduceInterface) *upLogger {
|
func With(ctx context.Context, p event.ProduceInterface) *upLogger {
|
||||||
|
floor = 4
|
||||||
return &upLogger{
|
return &upLogger{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
produce: p,
|
produce: p,
|
||||||
|
@ -40,7 +45,12 @@ func (l *upLogger) Print(level string, format string, msg ...interface{}) {
|
||||||
Print(level, format, msg...)
|
Print(level, format, msg...)
|
||||||
|
|
||||||
eventMiddle := event.NewEvent(middleMsg.EventNameLog)
|
eventMiddle := event.NewEvent(middleMsg.EventNameLog)
|
||||||
eventMiddle.SetValue(middleMsg.EventKeyLog, middleMsg.LogContext{})
|
eventMiddle.SetValue(middleMsg.EventKeyLog, middleMsg.LogContext{
|
||||||
|
Level: level,
|
||||||
|
Data: time.Now(),
|
||||||
|
Msg: fmt.Sprintf(format, msg...),
|
||||||
|
Route: findPlace(),
|
||||||
|
})
|
||||||
l.produce.Call(l.ctx, eventMiddle)
|
l.produce.Call(l.ctx, eventMiddle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +90,7 @@ func findPlace() string {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
place string
|
place string
|
||||||
i = 0
|
i = floor
|
||||||
)
|
)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
|
Loading…
Reference in New Issue