Skip to content

Commit

Permalink
Fixed the Cluster.Logger to be compatible with logger compile time pu…
Browse files Browse the repository at this point in the history
…rging (bitwalker#80)
  • Loading branch information
costaraphael authored and bitwalker committed Oct 4, 2018
1 parent 5d31c8d commit 9c8b1cf
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/logger.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ defmodule Cluster.Logger do
:ok

_ ->
log(:debug, t, msg)
Logger.debug(log_message(t, msg))
end
end

def info(t, msg), do: log(:info, t, msg)
def warn(t, msg), do: log(:warn, t, msg)
def error(t, msg), do: log(:error, t, msg)
def info(t, msg), do: Logger.info(log_message(t, msg))
def warn(t, msg), do: Logger.warn(log_message(t, msg))
def error(t, msg), do: Logger.error(log_message(t, msg))

defp log(level, t, msg), do: Logger.log(level, "[libcluster:#{t}] #{msg}")
@compile {:inline, log_message: 2}
defp log_message(t, msg) do
"[libcluster:#{t}] #{msg}"
end
end

0 comments on commit 9c8b1cf

Please sign in to comment.