| 1 |
% Copyright 2005 2015 Ovidiu Gheorghies |
| 2 |
% Licensed under the Apache License, Version 2.0. |
| 3 |
|
| 4 |
%%% if known _util_log_mp: |
| 5 |
%%% expandafter endinput |
| 6 |
%%% fi; |
| 7 |
_util_log_mp:=1; |
| 8 |
|
| 9 |
util_loglevel_PARANOIA:=1; |
| 10 |
util_loglevel_DEBUG:=2; |
| 11 |
util_loglevel_RELEASE:=3; |
| 12 |
util_loglevel_SILENT:=4; |
| 13 |
|
| 14 |
util_log_thresholdlevel := util_loglevel_DEBUG; |
| 15 |
util_log_defaultlevel := util_loglevel_RELEASE; |
| 16 |
|
| 17 |
def elog(expr loglevel) text txt= |
| 18 |
if (loglevel <= util_log_thresholdlevel): |
| 19 |
%includeonce% show txt |
| 20 |
else: |
| 21 |
% do nothing |
| 22 |
fi; |
| 23 |
enddef; |
| 24 |
|
| 25 |
def log text txt= |
| 26 |
if (util_log_defaultlevel <= util_log_thresholdlevel): |
| 27 |
show txt |
| 28 |
else: |
| 29 |
% do nothing |
| 30 |
fi; |
| 31 |
enddef; |