Skip to content

Commit c9c47c3

Browse files
committed
Add date to logger output
1 parent 0d0574a commit c9c47c3

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

config/config.exs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,29 @@ config :plug, :statuses, %{
2929
460 => "Invalid device token"
3030
}
3131

32+
lager_formater_config = [:date, 'T', :time, :color, ' [', :severity, '] ', :pid, ' ', :message, '\e[0m\r\n']
33+
config :lager,
34+
colored: true,
35+
handlers: [
36+
lager_console_backend: [
37+
level: :info,
38+
formatter: :lager_default_formatter,
39+
formatter_config: lager_formater_config
40+
],
41+
lager_file_backend: [
42+
file: 'log/error.log',
43+
level: :error,
44+
formatter: :lager_default_formatter,
45+
formatter_config: lager_formater_config
46+
],
47+
lager_file_backend: [
48+
file: 'log/console.log',
49+
level: :info,
50+
formatter: :lager_default_formatter,
51+
formatter_config: lager_formater_config
52+
]
53+
]
54+
3255
import_config "#{Mix.env}.exs"
3356

3457
# Globally disable maru's "test mode". If we don't disable it explicitly

lib/mongoose_push/service/apns.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ defmodule MongoosePush.Service.APNS do
7474
:dev -> :development_endpoint
7575
:prod -> :production_endpoint
7676
end
77-
Enum.into([{new_key, config[:endpoint]}], config)
77+
Keyword.put(config, new_key, config[:endpoint])
7878
end
7979

8080
defp announce_subject(config) do
@@ -101,7 +101,7 @@ defmodule MongoosePush.Service.APNS do
101101
all_topics = Certificate.extract_topics!(config[:cert])
102102
default_topic = all_topics[:topic]
103103
Logger.info(~s"Successfully extracted default APNS topic: #{default_topic}")
104-
Enum.into([default_topic: default_topic], config)
104+
Keyword.put(config, :default_topic, default_topic)
105105
default_topic ->
106106
Logger.info(~s"Using user-defined default APNS topic: #{default_topic}")
107107
config

mix.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ defmodule MongoosePush.Mixfile do
2525

2626
defp deps do
2727
[
28-
{:chatterbox, github: "joedevivo/chatterbox", ref: "ff0c2e054430d2990b588afa6fb8f2d184dfeaea", override: true},
2928
{:pigeon, github: "rslota/pigeon", ref: "2860eee35b58e2d8674f805f1151f57b9faeca21"},
29+
{:chatterbox, github: "joedevivo/chatterbox", ref: "ff0c2e0", override: true},
3030

3131
{:maru, github: "rslota/maru", ref: "54fc038", override: true},
3232
{:cowboy, "~> 2.3", override: true},
@@ -38,7 +38,7 @@ defmodule MongoosePush.Mixfile do
3838
{:confex, "~> 3.2", override: true},
3939
{:mix_docker, "~> 0.5"},
4040
{:uuid, "~> 1.1"},
41-
{:lager, ">= 3.6.9", override: true},
41+
{:lager, ">= 3.7.0", override: true},
4242
{:logger_lager_backend, "~> 0.1.0"},
4343

4444
# Just overrides to make elixometer compile...
@@ -79,7 +79,7 @@ defmodule MongoosePush.Mixfile do
7979
end
8080

8181
defp preferred_cli_env do
82-
["coveralls": :test, "coveralls.detail": :test,
82+
[coveralls: :test, "coveralls.detail": :test,
8383
"coveralls.travis": :test, "coveralls.html": :test]
8484
end
8585

mix.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
%{
2-
"artificery": {:hex, :artificery, "0.4.1", "90b1fcedb9034853b36dbea2174f9fc1172bd50b0686a723178103def5c9c1c8", [:mix], [], "hexpm"},
2+
"artificery": {:hex, :artificery, "0.4.2", "3ded6e29e13113af52811c72f414d1e88f711410cac1b619ab3a2666bbd7efd4", [:mix], [], "hexpm"},
33
"bear": {:hex, :bear, "0.8.5", "e95fca1627cd9e15baf93ce0a52aff16917baf325f0ee65b88cd715376cd2344", [:rebar3], [], "hexpm"},
44
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
55
"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm"},
6-
"chatterbox": {:git, "https://github.com/joedevivo/chatterbox.git", "ff0c2e054430d2990b588afa6fb8f2d184dfeaea", [ref: "ff0c2e054430d2990b588afa6fb8f2d184dfeaea"]},
6+
"chatterbox": {:git, "https://github.com/joedevivo/chatterbox.git", "ff0c2e054430d2990b588afa6fb8f2d184dfeaea", [ref: "ff0c2e0"]},
77
"confex": {:hex, :confex, "3.3.1", "8febaf751bf293a16a1ed2cbd258459cdcc7ca53cfa61d3f83d49dd276a992b4", [:mix], [], "hexpm"},
88
"cowboy": {:hex, :cowboy, "2.3.0", "268429481d6f41ad5564ade4a2439c284b569083fca0d19078ad4f56b4624724", [:rebar3], [{:cowlib, "~> 2.2.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.4.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"},
99
"cowlib": {:hex, :cowlib, "2.2.1", "1afa5b233cee8f642c153ec6f1dc48db0dd9a43e2114bc8b43e9d59636f6ae1f", [:rebar3], [], "hexpm"},
1010
"credo": {:hex, :credo, "0.9.3", "76fa3e9e497ab282e0cf64b98a624aa11da702854c52c82db1bf24e54ab7c97a", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:poison, ">= 0.0.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
1111
"dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"},
12-
"distillery": {:hex, :distillery, "2.0.12", "6e78fe042df82610ac3fa50bd7d2d8190ad287d120d3cd1682d83a44e8b34dfb", [:mix], [{:artificery, "~> 0.2", [hex: :artificery, repo: "hexpm", optional: false]}], "hexpm"},
12+
"distillery": {:hex, :distillery, "2.0.14", "25fc1cdad06282334dbf4a11b6e869cc002855c4e11825157498491df2eed594", [:mix], [{:artificery, "~> 0.2", [hex: :artificery, repo: "hexpm", optional: false]}], "hexpm"},
1313
"earmark": {:hex, :earmark, "1.2.5", "4d21980d5d2862a2e13ec3c49ad9ad783ffc7ca5769cf6ff891a4553fbaae761", [:mix], [], "hexpm"},
1414
"elixometer": {:git, "https://github.com/esl/elixometer.git", "6678c97f64ac8a4cf7ecbf32a4d342576d466b69", []},
1515
"ex_doc": {:hex, :ex_doc, "0.18.3", "f4b0e4a2ec6f333dccf761838a4b253d75e11f714b85ae271c9ae361367897b7", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
@@ -26,7 +26,7 @@
2626
"idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [:rebar3], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
2727
"jason": {:hex, :jason, "1.0.0", "0f7cfa9bdb23fed721ec05419bcee2b2c21a77e926bce0deda029b5adc716fe2", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
2828
"jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm"},
29-
"lager": {:hex, :lager, "3.6.9", "387bcd836dc0c8ad9c6d90a0e0ce5b29676847950cbc527bccc194a02028de8e", [:rebar3], [{:goldrush, "0.1.9", [hex: :goldrush, repo: "hexpm", optional: false]}], "hexpm"},
29+
"lager": {:hex, :lager, "3.7.0", "563ab17cd32134a3dd17ec3b3622e6d8f827506aa4f8c489158879bed87d980b", [:rebar3], [{:goldrush, "0.1.9", [hex: :goldrush, repo: "hexpm", optional: false]}], "hexpm"},
3030
"logger_lager_backend": {:hex, :logger_lager_backend, "0.1.0", "4858d5ac26a3a6085274933bf8b3061973cadac4adbe8e0181933e8cece78abb", [:mix], [{:lager, "~> 3.2", [hex: :lager, repo: "hexpm", optional: false]}], "hexpm"},
3131
"maru": {:git, "https://github.com/rslota/maru.git", "54fc0380cd4b7c8b597429d1fa70c2f08a714c01", [ref: "54fc038"]},
3232
"maru_swagger": {:git, "https://github.com/elixir-maru/maru_swagger.git", "e3dfad2bd01d50566c041dee3fcb4af375918244", []},

0 commit comments

Comments
 (0)