[api] introduce a loglevel threshold setting

This commit is contained in:
Bart Van Der Meerssche 2011-03-29 10:50:25 +00:00
parent d43a4cd9d5
commit 90bf363645
1 changed files with 7 additions and 2 deletions

View File

@ -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) ->