Open hellodit opened 2 years ago
try this:
lecho.New(&lumberjack.Logger{
Filename: "/var/log/myapp/foo.log",
MaxSize: 500, // megabytes
MaxBackups: 3,
MaxAge: 28, //days
Compress: true, // disabled by default
})
Hi @ziflex looking at integrating with an existing Echo app with zerolog and checking if you have plans to integrate the multple output (Stdout, consoleWriter, File)
zerolog.MultiLevelWriter(consoleWriter, os.Stdout)
See docs: https://github.com/rs/zerolog#multiple-log-output
I will take a look at lumberjack example, thanks
Hey @rrajkowski,
You should be able to do this with the existing API.
lecho.New(zerolog.MultiLevelWriter(consoleWriter, os.Stdout))
lecho.From(zerolog.New(zerolog.MultiLevelWriter(consoleWriter, os.Stdout)))
lecho.Middleware(lecho.Config{
Logger: lecho.New(zerolog.MultiLevelWriter(consoleWriter, os.Stdout)),
})
@ziflex thanks for the reply. I was able to implement the MultiLevelWriter. I am writting to Stdout and file.
I have a new issue added the response from c.Response
echo context to the lecho logger.
I've tried the following:
Enricher: func(c echo.Context, logger zerolog.Context) zerolog.Context {
return e.Interface("response", c.Response())
},
Ideally I can update or modify the logger context with response for a single stdout/file log. I think it would be cool to allow combining of Bodydump and Enricher somehow. I've read through this Zerolog guild but didn't find any working solutions
Let me know and I can move this to a new issue
Thanks
Hi, Is lecho have ability to save logs to file with *.log extension?