Comparison

core/loggingmanager.lua @ 4177:623e6d5f30b7

loggingmanager: Allow specifying a sink type in per-level logging config (thanks ruskie)
author Matthew Wild <mwild1@gmail.com>
date Sun, 13 Feb 2011 18:37:34 +0000
parent 4176:534c2ee81162
child 4427:ae71ae5ddcfc
comparison
equal deleted inserted replaced
4176:534c2ee81162 4177:623e6d5f30b7
86 -- them. Called automatically when a new sink type is added to 86 -- them. Called automatically when a new sink type is added to
87 -- the log_sink_types table. 87 -- the log_sink_types table.
88 function apply_sink_rules(sink_type) 88 function apply_sink_rules(sink_type)
89 if type(logging_config) == "table" then 89 if type(logging_config) == "table" then
90 90
91 if sink_type == "file" then 91 for _, level in ipairs(logging_levels) do
92 for _, level in ipairs(logging_levels) do 92 if type(logging_config[level]) == "string" then
93 if type(logging_config[level]) == "string" then 93 local value = logging_config[level];
94 if sink_type == "file" then
94 add_rule({ 95 add_rule({
95 to = "file", 96 to = sink_type;
96 filename = logging_config[level], 97 filename = value;
97 timestamps = true, 98 timestamps = true;
98 levels = { min = level }, 99 levels = { min = level };
100 });
101 elseif value == "*"..sink_type then
102 add_rule({
103 to = sink_type;
104 levels = { min = level };
99 }); 105 });
100 end 106 end
101 end 107 end
102 end 108 end
103 109