skycoin / teller

Skycoin exchange service
15 stars 30 forks source link

Add logrotate support #255

Closed gz-c closed 6 years ago

gz-c commented 6 years ago

This is a proposal for handling logs

Using https://github.com/NYTimes/logrotate

Add a new method similar to logger.NewFileWriteHook (src/util/logger.go) which wraps the *os.File pointer with the logrotate-aware wrapper.

Use this constructor instead of NewFileWriteHook during logger initialization.

Add a documentation section to the README regarding logrotate support:

logrotate can be configured to send a SIGHUP to the application to trigger a rotation, which teller supports

Add instructions for how to configure logrotate this way.

The SIGHUP mechanism requires a pid file. Possibly use this to add one: https://github.com/facebookgo/pidfile