-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instead of taking a string as the log group, take a keyword list with a single key, for possible extension later.
- Loading branch information
1 parent
68961ac
commit c48cc0b
Showing
2 changed files
with
8 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
defmodule Appsignal.Logger.Backend do | ||
@behaviour :gen_event | ||
|
||
def init({__MODULE__, group}) do | ||
{:ok, group} | ||
def init({__MODULE__, options}) do | ||
{:ok, Keyword.merge([group: "app"], options)} | ||
end | ||
|
||
def init(_) do | ||
{:ok, "app"} | ||
def handle_event({level, _gl, {Logger, message, _timestamp, metadata}}, options) do | ||
Appsignal.Logger.log(level, options[:group], IO.chardata_to_string(message), Enum.into(metadata, %{})) | ||
{:ok, options} | ||
end | ||
|
||
def handle_event({level, _gl, {Logger, message, _timestamp, metadata}}, group) do | ||
Appsignal.Logger.log(level, group, IO.chardata_to_string(message), Enum.into(metadata, %{})) | ||
{:ok, group} | ||
end | ||
|
||
def handle_call(_messsage, group) do | ||
{:ok, nil, group} | ||
def handle_call(_messsage, options) do | ||
{:ok, nil, options} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters