Skip to content

nerves-project/nerves_logging

Repository files navigation

NervesLogging

Hex version API docs CircleCI REUSE status

NervesLogging forwards log messages from the Linux kernel and syslog to the Elixir logger. It's used with Nerves so that all log messages pass through one place.

Messages logged by NervesLogging copy the "Syslog" severity directly to the Logger level. This means that if the kernel's level is "Error", the Elixir level will be :error. Since Elixir 1.11 and later have the same log levels as Syslog, this mapping is 1:1.

NervesLogging adds the following metadata to the log messages:

  • :facility - the facility of the log message
  • :application - either :$kmsg or :$syslog

See the Elixir Logger documentation for reducing what's logged if the system logs become too noisy. Some examples:

# Reduce logging for both syslog and kernel logs
Logger.put_application_level(:nerves_logging, :error)

# Adjust logging for kernel logs
Logger.put_module_level(NervesLogging.KmsgTailer, :error)

# Adjust logging for syslog logs
Logger.put_module_level(NervesLogging.SyslogTailer, :error)

Using

There's no configuration. If you're using Nerves, you should get this application by default since it's a dependency of nerves_runtime.

License

All original source code in this project is licensed under Apache-2.0.

Additionally, this project follows the REUSE recommendations and labels so that licensing and copyright are clear at the file level.

Exceptions to Apache-2.0 licensing are:

  • Configuration and data files are licensed under CC0-1.0
  • Documentation is CC-BY-4.0