View Source RotatingFile

Simple rotating file writer for additional logs that shouldn't go into the main application log.

# Rotate every 10mb, don't keep more than 10 files
{:ok, pid} = RotatingFile.start_link(file: "test.log", max_size: 10*1024*1024, max_files: 10)
RotatingFile.write(pid, "hello world\n")

This will create a test.log file and also test.log.<timestamp>.(zstd|xz|gz)

Installation

If available in Hex, the package can be installed by adding rotating_file to your list of dependencies in mix.exs:

def deps do
  [
    {:rotating_file, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/rotating_file.