Elixir 磁盘上的记录器

Logger on the disk in Elixir

我正在使用 Elixir 的默认记录器模块来生成日志。但是,我没有找到将日志转储到磁盘 上的方法。记录器模块中有这样的设施吗?或者是否有任何其他 Elixir/Erlang 库可以用于相同的?

Elixir 包含一个 Logger 库。 Logger 支持写入日志消息的不同后端,但是目前唯一的内置后端是 :console.

在 Erlang 世界中,众所周知的日志记录库之一是 Lager. In fact, this library was also mentioned last year in a discussion in the elixir-lang-core 邮件列表。

在同一个线程中也提到了这个项目:onkel-dirtus/logger_file_backend。我还没有尝试过,但它似乎就是你要找的。

LoggerFileBackend is a custom backend for the elixir :logger application. However, unlike the default :console backend, we may want to configure multiple log files, each with different log levels formats, etc.