OTP Logging

The OTP system comes packaged with a customizable error logger. We can look at the error logger from three points of view. The programmer view concerns the function calls that programmers make in their code in order to log an error. The configuration view is concerned with where and how the error logger stores its data. The report view is concerned with the analysis of errors after they have occurred. (Armstrong 2013, 387)

Logging an Error

  %% Send an error message to the error logger
  -spec error_logger:error_msg(String) -> ok.

  %% Send en error message with a certain format to the error logger
  -spec error_logger:error_msg(Format, Data) -> ok when
      Format :: string(),
      Data :: list().

  %% Send a standard error report to the error logger.
  -spec error_logger:error_report(Report) -> ok when
      Tag :: term(),
      Data :: term(),
      Report :: 
        [ {Tag, Data} | term() ]
        | string()
        | term().

Configuring the Error Logger

References:

Armstrong, Joe. 2013. “Programming Erlang: Software for a Concurrent World.”

Backlinks: