onkel-dirtus / logger_file_backend

MIT License
307 stars 128 forks source link

Rotate is already implemented, but not documented. #86

Open leonardorame opened 4 months ago

leonardorame commented 4 months ago

Hi, just to mention that rotation facility is already implemented in 0.0.14, but not documented.

The configuration should be like:

config :logger, :debug,
  path: "/path/to/debug.log",
  level: :debug,
  rotate: %{max_bytes: 10400, keep: 5}

This creates log files with a maximum size of 10400 bytes and only keep 5 files, like this:

debug.log
debug.log.1
debug.log.2
debug.log.3
debug.log.4

And don't forget to replace {:logger_file_backend, "~> 0.0.10"}, to {:logger_file_backend, "~> 0.0.14"},.

That's it.