27 lines
596 B
Go
27 lines
596 B
Go
package zerologctx
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
lz "github.com/karincake/apem/logger-zerolog"
|
|
"github.com/rs/zerolog"
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
func Adjust() {
|
|
lz.Ctx = log.Output(zerolog.ConsoleWriter{
|
|
Out: os.Stdout,
|
|
TimeFormat: "2006/01/02 15:04:05",
|
|
NoColor: true,
|
|
PartsOrder: []string{"time", "method", "status", "path", "query", "message"},
|
|
FieldsExclude: []string{"time", "scope", "method", "status", "path", "query"},
|
|
FormatFieldValue: func(i interface{}) string {
|
|
if i == nil {
|
|
return ""
|
|
}
|
|
return fmt.Sprintf("%v", i)
|
|
},
|
|
}).With()
|
|
}
|