View Source bugsnag (bugsnag_erlang v3.0.0-rc1)
BugSnag Erlang client.
Configuration
It can be configured using application environment variables or by passing a map to the
start_link/1
function.
If using application environment variables, the config looks like the following:
{bugsnag_erlang, [
{enabled, true},
{api_key, "BUGSNAG_API_KEY"},
{release_stage, "production"},
{handler_name, bugsnag_logger_handler},
{pool_size, 10}
]}
If enabled
is set to other than true, the rest of the configuration won't be read
and no handler will be registered. For the rest of the keys, see config/0
.
If a new handler wants to be added, the handler_name
key can be set to a new atom.
Summary
Types
Configuration options for the Bugsnag client.
Event to notify to BugSnag.
Metadata about the event.
A printable string
Functions
Add a new logger handler.
Add a new logger handler.
Notify of a bugsnag event.
Notify a global worker about an exception.
Notify a global worker about an exception.
Remove a new logger handler.
Add a new global bugsnag_logger_handler
handler.
Types
-type config() :: #{api_key := binary(), release_stage := binary(), name := logger_handler:id(), pool_size := pos_integer(), endpoint => binary(), events_limit => pos_integer()}.
Configuration options for the Bugsnag client.
It takes the following configuration options:
api_key
: the Bugsnag API key, mandatory to provide.release_stage
: the release stage of the application, defaults toproduction
name
: defaults tobugsnag_logger_handler
, but allows to create morelogger
handlers with different configurations.pool_size
: defaults to the number of schedulers, increases the number of workers in the pool in case of high load.endpoint
: allows you to configure a custom config, including testing endpoints.events_limit
: allows you to configure the maximum number of events to be sent to Bugsnag at once. If event queues fill too fast, older non-sent events will be dropped. The default is 1000, as an average big event including stacktraces is no bigger than 1KB, therefore 1000 events should keep the payload below 1MB.
-type event() :: #{what => text(), message => text(), class => exit | error | throw, reason => term(), stacktrace => [{module(), atom(), non_neg_integer() | [term()], [{atom(), _}]}], atom() => text()}.
Event to notify to BugSnag.
- Events that contain
#{class := _, reason := _, stacktrace := _}
, following the naming convention as exemplified byerlang:raise/3
, will be treated as exceptions to BugSnag. - Event structure will have all their printable key-value pairs as key-value pairs in
metaData
. breadcrumbs
will always contain the timestamp of the event.
-type metadata() :: #{mfa := {module(), atom(), non_neg_integer()}, line := non_neg_integer(), level => logger:level(), time => integer(), atom => term()}.
Metadata about the event.
The default severity level is warning
.
The default mfa
is {undefined, undefined, 0}
and line
is also 0.
A printable string
Functions
-spec add_handler(config()) -> supervisor:startchild_ret().
Add a new logger handler.
-spec add_handler(config(), logger_handler:config()) -> supervisor:startchild_ret().
Add a new logger handler.
Notify of a bugsnag event.
- Events that contain
#{class := _, reason := _, stacktrace := _}
, following the naming convention as exemplified byerlang:raise/3
, will be treated as exceptions to BugSnag. - Event structure will have all their printable key-value pairs as key-value pairs in
metaData
Notify a global worker about an exception.
-spec notify(atom(), atom() | string(), string() | binary(), module(), non_neg_integer(), [term()], term()) -> ok.
Notify a global worker about an exception.
-spec remove_handler(logger_handler:id() | config()) -> ok | {error, term()}.
Remove a new logger handler.
-spec start_link(binary(), binary()) -> gen_server:start_ret().
Add a new global bugsnag_logger_handler
handler.
This is deprecated, add_handler/1
is preferred.