Home

Awesome

Travis Hex.pm Version Hex.pm License Build Tool

NOTE: Since both Erlang and Elixir provide pluggable logging facilities out of the box for a while now, the benefit of using hut has been reduced. One may still use it, however it doesn't provide much benefit nowadays.

Overview

hut is a minimal library for Erlang libraries and small applications to stay agnostic to the logging framework in use. Its purpose is to allow the developers of umbrella applications to use their logging framework of choice and ensure that dependency stick to that choice as well.

Origin

The idea for hut came out of a discussion about exometer_core's logging facilities.

Usage

  1. Include hut as a dependency in your toolchain.
  2. Include hut in your .erl files via -include_lib(hut/include/hut.hrl)
  3. Log with
  1. Compile and pass the appropriate macro to the compiler to enable a certain backend as described next.
  2. Ensure that the application hut is started as part of your system.

Supported Logging Backends

Log Level Gates

hut provides a simple mechanisms to drop log messages depending on the enabled log level. The functionality is similar to how Lager works with log levels.

The current log level (default is info) can be set through the application variable level:

erl -hut level debug

All log messages with levels below the current log level will be dropped.

The gating mechanism can be disabled through the application variable use_log_level_gate:

erl -hut use_log_level_gate false

NOTE: The gating mechanism is not supported for the Lager backend, since Lager itself provides a similar functionality which you should rely on when using Lager.

Examples

Refer to the respective Makefile in each example for details.