[api] introduce a loglevel threshold setting
This commit is contained in:
parent
d43a4cd9d5
commit
90bf363645
|
@ -176,8 +176,11 @@ time_to_seconds(Time) ->
|
||||||
-define(INFO, 6).
|
-define(INFO, 6).
|
||||||
-define(DEBUG, 7).
|
-define(DEBUG, 7).
|
||||||
|
|
||||||
|
% logging severity threshold
|
||||||
|
-define(LOGLEVEL, 7).
|
||||||
|
|
||||||
% log to Drupal's watchdog table
|
% log to Drupal's watchdog table
|
||||||
logger(Uid, Type, Message, Severity, ReqData) ->
|
logger(Uid, Type, Message, Severity, ReqData) when Severity =< ?LOGLEVEL ->
|
||||||
mysql:execute(pool, watchdog,
|
mysql:execute(pool, watchdog,
|
||||||
[Uid,
|
[Uid,
|
||||||
Type,
|
Type,
|
||||||
|
@ -187,7 +190,9 @@ logger(Uid, Type, Message, Severity, ReqData) ->
|
||||||
list_to_binary(wrq:raw_path(ReqData)),
|
list_to_binary(wrq:raw_path(ReqData)),
|
||||||
list_to_binary(wrq:peer(ReqData)),
|
list_to_binary(wrq:peer(ReqData)),
|
||||||
unix_time()
|
unix_time()
|
||||||
]).
|
]);
|
||||||
|
logger(_Uid, _Type, _Message, _Severity, _ReqData) ->
|
||||||
|
true.
|
||||||
|
|
||||||
% erlrrd wrappers
|
% erlrrd wrappers
|
||||||
rrd_fetch(Path, RrdSensor, RrdStart, RrdEnd, RrdResolution) ->
|
rrd_fetch(Path, RrdSensor, RrdStart, RrdEnd, RrdResolution) ->
|
||||||
|
|
Loading…
Reference in New Issue