Membrane.Log.Logger.Base behaviour (Membrane Core v0.8.1) View Source

This behaviour is deprecated. Use Elixir `Logger` instead.

This is a base module used by all logger implementations.

Link to this section Summary

Callbacks

Callback invoked when logger is initialized, right after new process is spawned.

Callback invoked when new log message is received.

Callback invoked when logger is shutting down just before process is exiting. It will receive the logger state.

Link to this section Callbacks

Link to this callback

handle_init(logger_options_t)

View Source

Specs

handle_init(Membrane.Log.Logger.logger_options_t()) ::
  {:ok, any()} | {:error, any()}

Callback invoked when logger is initialized, right after new process is spawned.

On success it should return {:ok, initial_logger_state}.

Link to this callback

handle_log(msg_level_t, message_t, t, list, any)

View Source

Specs

Callback invoked when new log message is received.

Callback delivers 5 arguments:

  • atom containing log level
  • message - in IO list format
  • time
  • tags (list of atoms, e.g. module name)
  • internal logger state

On success, it returns {:ok, new_state}. it will just update logger's state to the new state.

If it returns {:error, reason, new_state} it indicates that something went wrong, and logger was unable to handle log. State will be updated to the new state.

Specs

handle_shutdown(any()) :: any()

Callback invoked when logger is shutting down just before process is exiting. It will receive the logger state.

Return value is ignored.