Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing bug: filters were not read from configration file

  • Loading branch information...
commit ba430440c55b57463be50ebd61957cb02572d179 1 parent 480bb67
@StevenLooman authored
View
4 blammo.xml
@@ -8,6 +8,10 @@
<encoder type="dummy_encoder"/>
<layout type="pattern_layout">%timestamp|%pid|%logger|%level|%message</layout>
+ <filters>
+ <filter type="threshold_filter">DEBUG</filter>
+ </filters>
+
<config>
<filename>/tmp/blammo.log</filename>
</config>
View
18 lib/configuration_reader.js
@@ -102,16 +102,24 @@ function parseAppender(node) {
var layoutNode = getChildByTagName(node, 'layout');
var layout = parseLayout(layoutNode);
- var filtersNode = getChildByTagName(node, 'filters');
- var filters = parseFilters(filtersNode);
-
var configNode = getChildByTagName(node, 'config');
var config = {};
if (configNode) {
config = parseAppenderConfig(configNode);
}
- return new knownAppenders[type](name, encoder, layout, config);
+ var appender = new knownAppenders[type](name, encoder, layout, config);
+
+
+ var filtersNode = getChildByTagName(node, 'filters');
+ var filters = parseFilters(filtersNode);
+
+ filters.forEach(function(filter) {
+ appender.addFilter(filter);
+ });
+
+
+ return appender;
}
function parseEncoder(node) {
@@ -137,7 +145,7 @@ function parseFilters(node) {
var filters = [];
filterNodes.forEach(function(filterNode) {
var filter = parseFilter(filterNode);
- filters.append(filter);
+ filters.push(filter);
});
return filters;
View
2  lib/threshold_filter.js
@@ -8,7 +8,7 @@ var Levels = require('./levels');
* DENYs all mesasges which are above the configured level
*/
function ThresholdFilter(level) {
- this.level = level;
+ this.level = Levels[level];
}
Please sign in to comment.
Something went wrong with that request. Please try again.