DiscoLog (disco_log v2.0.0-rc.1)

View Source

Send messages to Discord

All functions in this module accept optional context and config parameters.

  • context is the last opportunity to assign some metadata that will be attached to the message or occurrence. Occurrences will additionally be tagged if context key names match existing channel tags.
  • config is important if you're running advanced configuration

Summary

Functions

Sends text message to the channel configures as error_channel_id

Sends text message to the channel configured as info_channel_id

Report catched error to occurrences channel

Functions

log_error(message, context \\ %{}, config \\ nil)

Sends text message to the channel configures as error_channel_id

log_info(message, context \\ %{}, config \\ nil)

Sends text message to the channel configured as info_channel_id

report(kind, reason, stacktrace, context \\ %{}, config \\ nil)

Report catched error to occurrences channel

This function reports an error directly to the occurrences channel, bypassing logging.

Example:

try do
  raise "Unexpected!"
catch 
  kind, reason -> DiscoLog.report(kind, reason, __STACKTRACE__)
end