agent-python icon indicating copy to clipboard operation
agent-python copied to clipboard

feat: rotating client.log

Open bigpick opened this issue 1 year ago • 0 comments

Info

Closes https://github.com/hashtopolis/server/issues/667

Switches the client log (client.log) to use a RotatingFileHandler instead of just a raw open file handle.

Adds two CLI arguments to adjust log rotation behavior, with sane defaults

  • --max-log-size
  • --max-log-backups

Suppose could make make it opt-in instead, if desired, and only use this new rotating option if --rotating-logger or somesuch was also passed. This way default functionality satisfies backwards compatibility such that not passing any new arguments would result in the client.log just growing indefinitely via the single raw open() handler (lmk if thats desired and can make that change)

Testing

I built a hashtopolis.zip agent bundle and synced it to our setup and configured to use it and nothing broke that I saw ¯_(ツ)_/¯. Log rotated as expected and kept specified number of backups.

bigpick avatar Aug 06 '24 18:08 bigpick