mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 01:34:24 +08:00
modify log format
This commit is contained in:
@@ -33,7 +33,7 @@ func (c *XOrmContextAdapter) Err() error {
|
|||||||
// if no value is associated with key.
|
// if no value is associated with key.
|
||||||
func (c *XOrmContextAdapter) Value(key any) any {
|
func (c *XOrmContextAdapter) Value(key any) any {
|
||||||
if key == log.SessionIDKey && c.requestId != "" {
|
if key == log.SessionIDKey && c.requestId != "" {
|
||||||
return fmt.Sprintf("r=%s", c.requestId)
|
return fmt.Sprintf("%s", c.requestId)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ func (f *LogFormatter) Format(entry *logrus.Entry) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if requestId, exists := entry.Data[logFieldRequestId]; exists {
|
if requestId, exists := entry.Data[logFieldRequestId]; exists {
|
||||||
b.WriteString(fmt.Sprintf("[r=%s] ", requestId))
|
b.WriteString(fmt.Sprintf("[%s] ", requestId))
|
||||||
}
|
}
|
||||||
|
|
||||||
b.WriteString(entry.Message)
|
b.WriteString(entry.Message)
|
||||||
|
|||||||
Reference in New Issue
Block a user