View Source Logger.Backends.Sentry (logger_sentry v0.8.0-rc2)

This module is the sentry backend for Logger and it can handle the event message from the Logger event server and push the log message to the sentry dashboard.

This module have a set of interface functions:

  • get/set the log level
  • get/set the log metadata

Config

Set the configuration for :logger as follow and the Sentry backend will push logging messages to the Sentry dashboard.

config :logger,
  backends: [:console, Logger.Backends.File],
  sentry: [
    level: :error,
    metadata: []
  ]

Suppressing Sentry logging

When you want to suppress Sentry logging for a specific Logger call even if Sentry level is met to the level, pass following option:

[logger_sentry: [skip_sentry: boolean]]

For example, if Sentry level is set to :error, and you want to suppress Sentry logging for a specific error logging:

Logger.error("error msg", [logger_sentry: [skip_sentry: true]])

Link to this section Summary

Functions

Get the backend log level.

Set the backend log level.

Get the backend log metadata.

Set the backend log metadata.

Link to this section Functions

Specs

level() :: :debug | :info | :warning | :error

Get the backend log level.

Specs

level(:debug | :info | :warning | :error) :: :ok | :error_level

Set the backend log level.

Specs

metadata() :: :all | list()

Get the backend log metadata.

Specs

metadata(:all | list()) :: :error_metadata | :ok

Set the backend log metadata.