Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does default level really work? #6

Closed
edasque opened this issue May 2, 2013 · 4 comments
Closed

Does default level really work? #6

edasque opened this issue May 2, 2013 · 4 comments

Comments

@edasque
Copy link

edasque commented May 2, 2013

Following your document example to the letter but for:

// Import
var level  = process.argv.indexOf('-d') === -1 ? 6 : 7;
var logger = new (require('caterpillar').Logger)({level:level});
var filter = new (require('caterpillar-filter').Filter)();
var human  = new (require('caterpillar-human').Human)();

The following doesn't seem to have any effect:

logger.log('this is level 6, the default level');
@balupton
Copy link
Member

balupton commented May 6, 2013

Works as expected for me...

$ node example.js 
emergency: this is level 0
emergency: this is level 0
alert: this is level 1
critical: this is level 2
critical: this is level 2
error: this is level 3
error: this is level 3
warning: this is level 4
warning: this is level 4
notice: this is level 5
notice: this is level 5
info: this is level 6
info: this is level 6
info: can also use as many arguments as you want 1 [ 2, 3 ] { four: 5 }

$ node example.js  -d
emergency: this is level 0
    → [2013-05-06 19:03:13.949] [/Users/balupton/Projects/caterpillar/example.js:16] [Object.<anonymous>]
emergency: this is level 0
    → [2013-05-06 19:03:13.952] [/Users/balupton/Projects/caterpillar/example.js:17] [Object.<anonymous>]
alert: this is level 1
    → [2013-05-06 19:03:13.953] [/Users/balupton/Projects/caterpillar/example.js:18] [Object.<anonymous>]
critical: this is level 2
    → [2013-05-06 19:03:13.953] [/Users/balupton/Projects/caterpillar/example.js:19] [Object.<anonymous>]
critical: this is level 2
    → [2013-05-06 19:03:13.953] [/Users/balupton/Projects/caterpillar/example.js:20] [Object.<anonymous>]
error: this is level 3
    → [2013-05-06 19:03:13.954] [/Users/balupton/Projects/caterpillar/example.js:21] [Object.<anonymous>]
error: this is level 3
    → [2013-05-06 19:03:13.954] [/Users/balupton/Projects/caterpillar/example.js:22] [Object.<anonymous>]
warning: this is level 4
    → [2013-05-06 19:03:13.955] [/Users/balupton/Projects/caterpillar/example.js:23] [Object.<anonymous>]
warning: this is level 4
    → [2013-05-06 19:03:13.955] [/Users/balupton/Projects/caterpillar/example.js:24] [Object.<anonymous>]
notice: this is level 5
    → [2013-05-06 19:03:13.956] [/Users/balupton/Projects/caterpillar/example.js:25] [Object.<anonymous>]
notice: this is level 5
    → [2013-05-06 19:03:13.956] [/Users/balupton/Projects/caterpillar/example.js:26] [Object.<anonymous>]
info: this is level 6
    → [2013-05-06 19:03:13.956] [/Users/balupton/Projects/caterpillar/example.js:27] [Object.<anonymous>]
info: this is level 6
    → [2013-05-06 19:03:13.957] [/Users/balupton/Projects/caterpillar/example.js:28] [Object.<anonymous>]
debug: this is level 7
    → [2013-05-06 19:03:13.957] [/Users/balupton/Projects/caterpillar/example.js:29] [Object.<anonymous>]
info: can also use as many arguments as you want 1 [ 2, 3 ] { four: 5 }
    → [2013-05-06 19:03:13.959] [/Users/balupton/Projects/caterpillar/example.js:31] [Object.<anonymous>]

Notice how without the -d flag (so log level 6) the debug log level is filtered out (log level 7). But with the -d flag (so log level 7) the debug log levels are kept.

@edasque
Copy link
Author

edasque commented May 6, 2013

Actually, no, it's not working for you either. Unless you don't have this line:

logger.log('this is level 6, the default level');

that should output, AFAIK:

info: this is level 6, the default level

@balupton
Copy link
Member

balupton commented May 6, 2013

Ohhhh... Sorry I must have misread the issue. Gotcha, yeah definitely doesn't seem to be working. I'll look into it tomorrow maybe if I get some time.

@balupton
Copy link
Member

balupton commented May 7, 2013

Fixed in v2.0.2 :) Thanks for the report!

@balupton balupton closed this as completed May 7, 2013
balupton added a commit that referenced this issue May 7, 2013
- v2.0.2 May 7, 2013
	- Fixed defaulting the log level
		- Closes [issue #6](#6)
reported by [Erik Dasque](https://github.com/edasque)
yumitsu pushed a commit to forgotten-labors/caterpillar.npm that referenced this issue Oct 2, 2014
- v2.0.2 May 7, 2013
	- Fixed defaulting the log level
		- Closes [issue bevry#6](bevry#6)
reported by [Erik Dasque](https://github.com/edasque)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants