The Error Logger

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. We’ll look at each of these in turn.

Logging an Error

As far as the programmer is concerned, the API to the error logger is simple. Here’s a simple subset of the API:

-spec error_logger:error_msg(String) -> ok

Send an error message to the error logger.

 
1>​ error_logger:error_msg("An error has occurred\n").
 
=ERROR REPORT==== ...

Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.