amari.xlog: Implement log rotation
Rotate output enb.xlog ourselves at sync points so that nothing is lost
in the output (hello logrotate copytruncate
) and so that we can emit
pre- and post- logrotate syncs.
Reuse logging's RotatingFileHandler and TimedRotatingFileHandler to implement actual rotation, but carefully wrap them in our writer classes so that we emit exactly the output we prepared explicitly without any headers prepended by logging, and that we explicitly control when rotation happens.
/cc @lu.xu, @xavier_thompson