Elixir 日志中的额外空行?

Rog*_*mbe 5 elixir

当我用 运行我的 Elixir 应用程序时_build/prod/rel/foo/bin/foo foreground,控制台日志中有额外的空行:

16:22:37.911 [info]  GET /

16:22:37.911 [info]  Sent 200 in 30µs

16:22:37.975 [info]  GET /favicon.ico

16:22:37.975 [info]  Sent 401 in 30µs
Run Code Online (Sandbox Code Playgroud)

我正在使用插头(没有 Phoenix)Plug.Logger;该版本是由酿酒厂建造的。我没有做任何特定于配置日志记录的事情。

我如何摆脱空行?

fre*_*rik 6

您可以覆盖 elixir 中的记录器格式,默认情况下,每行前后都包含一个换行符。通过将其添加到您的config.exs:

config :logger, :console,
  format: "$time $metadata[$level] $levelpad$message\n"
Run Code Online (Sandbox Code Playgroud)

有关默认记录器的更多信息:https : //github.com/elixir-lang/elixir/blob/v1.7.2/lib/logger/lib/logger/formatter.ex