mtingers / botic

Free, open-source, extendable crypto trading bot
GNU General Public License v3.0
8 stars 5 forks source link

Make logging cloud-friendly #1

Open alxmrs opened 3 years ago

alxmrs commented 3 years ago

Log statements are currently written to a file. If the bot is deployed to a VM instance, it will eventually run out of disk space.

Ideally, logs should be treated as event streams. Also, it'd be nice to use pythons standard log library.

mtingers commented 3 years ago

Logging does need more options. For the most part, stdout/stderr logging covers things like systemd and containers, but might not be ideal for some setups. I propose:

  1. stdout is always on (see: Python's logging StreamHandler)
  2. Optional configuration for a log handler mapped to Python's handlers. Examples:
    • simple for WatchedFileHandler
    • rotate_time for TimedRotatingFileHandler
    • rotate_size for RotatingFileHandler

Configuration could look something like:

[logging]
# simple | rotate_time | rotate_size
handler = rotate_size
filename = /path/to/logfile.log
max_bytes = 104857600
backups = 10