add logger output

This commit is contained in:
dpurbosakti
2025-08-25 09:41:07 +07:00
parent a4a0a4f672
commit 497d209456
2 changed files with 28 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
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()
}