Software /
code /
prosody
Comparison
core/loggingmanager.lua @ 4627:b046cafc81a8
loggingmanager, util.logger: Remove name sinks and the ability to filter logs by source name (lots of code, hardly used if at all, and possibly broken)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 15 Mar 2012 19:09:24 +0000 |
parent | 4427:ae71ae5ddcfc |
child | 5001:78a3d275715a |
comparison
equal
deleted
inserted
replaced
4626:9df9e87d0339 | 4627:b046cafc81a8 |
---|---|
46 -- Put a rule into action. Requires that the sink type has already been registered. | 46 -- Put a rule into action. Requires that the sink type has already been registered. |
47 -- This function is called automatically when a new sink type is added [see apply_sink_rules()] | 47 -- This function is called automatically when a new sink type is added [see apply_sink_rules()] |
48 local function add_rule(sink_config) | 48 local function add_rule(sink_config) |
49 local sink_maker = log_sink_types[sink_config.to]; | 49 local sink_maker = log_sink_types[sink_config.to]; |
50 if sink_maker then | 50 if sink_maker then |
51 if sink_config.levels and not sink_config.source then | 51 -- Create sink |
52 -- Create sink | 52 local sink = sink_maker(sink_config); |
53 local sink = sink_maker(sink_config); | 53 |
54 | 54 -- Set sink for all chosen levels |
55 -- Set sink for all chosen levels | 55 for level in pairs(get_levels(sink_config.levels or logging_levels)) do |
56 for level in pairs(get_levels(sink_config.levels)) do | 56 logger.add_level_sink(level, sink); |
57 logger.add_level_sink(level, sink); | |
58 end | |
59 elseif sink_config.source and not sink_config.levels then | |
60 logger.add_name_sink(sink_config.source, sink_maker(sink_config)); | |
61 elseif sink_config.source and sink_config.levels then | |
62 local levels = get_levels(sink_config.levels); | |
63 local sink = sink_maker(sink_config); | |
64 logger.add_name_sink(sink_config.source, | |
65 function (name, level, ...) | |
66 if levels[level] then | |
67 return sink(name, level, ...); | |
68 end | |
69 end); | |
70 else | |
71 -- All sources | |
72 -- Create sink | |
73 local sink = sink_maker(sink_config); | |
74 | |
75 -- Set sink for all levels | |
76 for _, level in pairs(logging_levels) do | |
77 logger.add_level_sink(level, sink); | |
78 end | |
79 end | 57 end |
80 else | 58 else |
81 -- No such sink type | 59 -- No such sink type |
82 end | 60 end |
83 end | 61 end |