Network Logger is a logger backend that outputs elixir logs to tcp/udp
Most of it was shamelessly copied from json_logger.
Network Logger currently provides very few options:
- level: The minimal level of logging. There's no default of this option. Example:
level: :warn
- output: The output of the log. Must be either
:console
or{:udp, host, port}
or{:tcp, host, port}
. Example:output: {:udp, "localhost", 514}
- metadata: Keys from the metadata to log. Example:
metadata: [:pid]
- format: Format of the log file. Example:
"$time $metadata[$level] $message\n"
(default)
Example configuration:
config :logger, :network_logger,
level: :info,
format: "$time $metadata[$level] $message\n",
metadata: [:pid, :module],
output: {:udp, "localhost", 514}
TCP support is still experimental, please submit issues that you encounter.
You need to add this backend to your Logger
:
# in your config...
config :logger,
backends: [
Logger.Backends.Network,
]
# or, in your code...
Logger.add_backend Logger.Backends.Network