-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathrebar3_riak_core.lager.schema
164 lines (142 loc) · 5.71 KB
/
rebar3_riak_core.lager.schema
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
%% -*- erlang -*-
%% complex lager example
%% @doc where do you want the console.log output:
%% off : nowhere
%% file: the file specified by log.console.file
%% console : standard out
%% both : log.console.file and standard out.
{mapping, "log.service", "lager.service",
[{default, "{{service}}"},
{datatype, string}]}.
{mapping, "log.console", "lager.handlers",
[{default, file},
{datatype, {enum, [off, file, console, both]}}]}.
%% @doc the log level of the console log
{mapping, "log.console.level", "lager.handlers",
[{default, info},
{datatype, {enum, [debug, info, warning, error]}}]}.
%% @doc location of the console log
{mapping, "log.console.file", "lager.handlers",
[{datatype, file},
{default, "{{log_path}}/console.log"}]}.
%% @doc location of the error log
{mapping, "log.error.file", "lager.handlers",
[{datatype, file},
{default, "{{log_path}}/error.log"}]}.
%% @doc location of the debug log
{mapping, "log.debug.file", "lager.handlers",
[{datatype, [{atom, off}, file]},
{default, off},
{commented, "{{log_path}}/debug.log"}]}.
%% *gasp* notice the same @mapping!
%% @doc turn on syslog
{mapping, "log.syslog", "lager.handlers",
[{default, off},
{datatype, {enum, [on, off]}}]}.
{translation,
"lager.handlers",
fun(Conf) ->
Service = cuttlefish:conf_get("log.service", Conf),
SyslogHandler =
case cuttlefish:conf_get("log.syslog", Conf) of
on -> [{lager_syslog_backend, [Service, daemon, info]}];
_ -> []
end,
ErrorHandler =
case cuttlefish:conf_get("log.error.file", Conf) of
undefined -> [];
ErrorFilename -> [{lager_file_backend, [{file, ErrorFilename},
{level, error},
{size, 10485760},
{date, "$D0"},
{count, 5}]}]
end,
ConsoleLogLevel = cuttlefish:conf_get("log.console.level", Conf),
ConsoleLogFile = cuttlefish:conf_get("log.console.file", Conf),
ConsoleHandler = {lager_console_handler, ConsoleLogLevel},
ConsoleFileHandler = {lager_file_backend, [{file, ConsoleLogFile},
{level, ConsoleLogLevel},
{size, 10485760},
{date, "$D0"},
{count, 5}]},
ConsoleHandlers = case cuttlefish:conf_get("log.console", Conf) of
off -> [];
file -> [ConsoleFileHandler];
console -> [ConsoleHandler];
both -> [ConsoleHandler, ConsoleFileHandler];
_ -> []
end,
DebugHandler =
case cuttlefish:conf_get("log.debug.file", Conf) of
undefined -> [];
off -> [];
"off" -> [];
DebugFilename -> [{lager_file_backend, [{file, DebugFilename},
{level, debug},
{size, 10485760},
{date, "$D0"},
{count, 5}]}]
end,
SyslogHandler ++ ConsoleHandlers ++ ErrorHandler ++ DebugHandler
end
}.
%% Lager Config
%% @doc Whether to write a crash log, and where.
%% Commented/omitted/undefined means no crash logger.
{mapping, "log.crash.file", "lager.crash_log",
[{default, "{{log_path}}/crash.log"}]}.
%% @doc Maximum size in bytes of events in the crash log - defaults to 65536
%% @datatype integer
%% @mapping
{mapping, "log.crash.msg_size", "lager.crash_log_msg_size",
[{default, "64KB"},
{datatype, bytesize}]}.
%% @doc Maximum size of the crash log in bytes, before its rotated, set
%% to 0 to disable rotation - default is 0
{mapping, "log.crash.size", "lager.crash_log_size",
[{default, "10MB"},
{datatype, bytesize}]}.
%% @doc What time to rotate the crash log - default is no time
%% rotation. See the lager README for a description of this format:
%% https://github.com/basho/lager/blob/master/README.org
{mapping, "log.crash.date", "lager.crash_log_date",
[{default, "$D0"}]}.
%% @doc Number of rotated crash logs to keep, 0 means keep only the
%% current one - default is 0
{mapping, "log.crash.count", "lager.crash_log_count",
[{default, 5},
{datatype, integer}]}.
%% @doc Whether to redirect error_logger messages into lager - defaults to true
{mapping, "log.error.redirect", "lager.error_logger_redirect",
[{default, on},
{datatype, {enum, [on, off]}}]}.
{translation,
"lager.error_logger_redirect",
fun(Conf) ->
Setting = cuttlefish:conf_get("log.error.redirect", Conf),
case Setting of
on -> true;
off -> false;
_Default -> true
end
end}.
%% @doc maximum number of error_logger messages to handle in a second
%% lager 2.0.0 shipped with a limit of 50, which is a little low for riak's startup
{mapping, "log.error.messages_per_second", "lager.error_logger_hwm",
[{default, 100},
{datatype, integer}]}.
%% SASL
%% We should never care about this
{mapping, "sasl", "sasl.sasl_error_logger",
[{default, off},
{datatype, {enum, [on, off]}},
{level, advanced}]}.
{translation,
"sasl.sasl_error_logger",
fun(Conf) ->
case cuttlefish:conf_get("sasl", Conf) of %%how to pull default?
on -> true;
_ -> false
end
end
}.