issue #31: DEBUG et al defines in '-c' scripts bleed into log records
This commit is contained in:
parent
156d2c4aff
commit
cfa64e9f97
2 changed files with 6 additions and 10 deletions
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
## bunyan 0.11.2 (not yet released)
|
## bunyan 0.11.2 (not yet released)
|
||||||
|
|
||||||
(nothing yet)
|
- [issue #31] Pull the TRACE, DEBUG, et al defines from `bunyan -c "..."`
|
||||||
|
filtering code. This was added in v0.11.1, but has a significant adverse
|
||||||
|
affect.
|
||||||
|
|
||||||
|
|
||||||
## bunyan 0.11.1
|
## bunyan 0.11.1
|
||||||
|
|
12
bin/bunyan
12
bin/bunyan
|
@ -317,12 +317,6 @@ function parseArgv(argv) {
|
||||||
}
|
}
|
||||||
args = newArgs;
|
args = newArgs;
|
||||||
|
|
||||||
var condDefines = [];
|
|
||||||
Object.keys(upperNameFromLevel).forEach(function (lvl) {
|
|
||||||
condDefines.push(format("var %s = %s;", upperNameFromLevel[lvl], lvl));
|
|
||||||
});
|
|
||||||
condDefines = condDefines.join('\n') + '\n';
|
|
||||||
|
|
||||||
var endOfOptions = false;
|
var endOfOptions = false;
|
||||||
while (args.length > 0) {
|
while (args.length > 0) {
|
||||||
var arg = args.shift();
|
var arg = args.shift();
|
||||||
|
@ -377,11 +371,11 @@ function parseArgv(argv) {
|
||||||
case "-c":
|
case "-c":
|
||||||
case "--condition":
|
case "--condition":
|
||||||
var condition = args.shift();
|
var condition = args.shift();
|
||||||
parsed.conditions = parsed.conditions || []
|
parsed.conditions = parsed.conditions || [];
|
||||||
var scriptName = 'bunyan-condition-'+parsed.conditions.length;
|
var scriptName = 'bunyan-condition-'+parsed.conditions.length;
|
||||||
var script = vm.createScript(condDefines + condition, scriptName);
|
var script = vm.createScript(condition, scriptName);
|
||||||
parsed.conditions.push(script);
|
parsed.conditions.push(script);
|
||||||
break
|
break;
|
||||||
default: // arguments
|
default: // arguments
|
||||||
if (!endOfOptions && arg.length > 0 && arg[0] === '-') {
|
if (!endOfOptions && arg.length > 0 && arg[0] === '-') {
|
||||||
throw new Error("unknown option '"+arg+"'");
|
throw new Error("unknown option '"+arg+"'");
|
||||||
|
|
Loading…
Reference in a new issue