mirror of
https://github.com/infinite-iroha/touka.git
synced 2026-02-03 08:51:11 +08:00
ctx add logreco method
This commit is contained in:
parent
899d3ff48b
commit
b8a1c5523a
2 changed files with 27 additions and 0 deletions
25
context.go
25
context.go
|
|
@ -488,3 +488,28 @@ func (c *Context) GetHTTPC() *httpc.Client {
|
||||||
func (c *Context) GetLogger() *reco.Logger {
|
func (c *Context) GetLogger() *reco.Logger {
|
||||||
return c.engine.LogReco
|
return c.engine.LogReco
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// === 日志记录 ===
|
||||||
|
func (c *Context) Debugf(format string, args ...any) {
|
||||||
|
c.engine.LogReco.Debugf(format, args...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Context) Infof(format string, args ...any) {
|
||||||
|
c.engine.LogReco.Infof(format, args...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Context) Warnf(format string, args ...any) {
|
||||||
|
c.engine.LogReco.Warnf(format, args...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Context) Errorf(format string, args ...any) {
|
||||||
|
c.engine.LogReco.Errorf(format, args...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Context) Fatalf(format string, args ...any) {
|
||||||
|
c.engine.LogReco.Fatalf(format, args...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Context) Panicf(format string, args ...any) {
|
||||||
|
c.engine.LogReco.Panicf(format, args...)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package touka
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/fenthope/reco"
|
"github.com/fenthope/reco"
|
||||||
)
|
)
|
||||||
|
|
@ -11,6 +12,7 @@ import (
|
||||||
var defaultLogRecoConfig = reco.Config{
|
var defaultLogRecoConfig = reco.Config{
|
||||||
Level: reco.LevelInfo,
|
Level: reco.LevelInfo,
|
||||||
Mode: reco.ModeText,
|
Mode: reco.ModeText,
|
||||||
|
TimeFormat: time.RFC3339,
|
||||||
Output: os.Stdout,
|
Output: os.Stdout,
|
||||||
Async: true,
|
Async: true,
|
||||||
DefaultFields: nil,
|
DefaultFields: nil,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue