Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotating files #140

Open
nurlybekovnt opened this issue Jul 1, 2019 · 1 comment
Open

Rotating files #140

nurlybekovnt opened this issue Jul 1, 2019 · 1 comment

Comments

@nurlybekovnt
Copy link

Hi, thanks a lot for that great implementation of logger
How and where can I add file rotationg(every day)? I want to hold logs for every single day in separate files, and I think it would be better if I implement this using goroutines

@cedricve
Copy link

cedricve commented Aug 6, 2019

This library is great: https://github.com/natefinch/lumberjack.

fileBackend := logging.NewLogBackend(&lumberjack.Logger{
Filename:   "./logs/log.log",
MaxSize:    2, // megabytes
Compress:   true, // disabled by default
}, "", 0)
logging.SetBackend(stdBackendLeveled, mqttBackend, fileBackend)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants