microsoftarchive / wunderbits.core

Core components of Wunderbits. Dependency free, high quality, 100% coverage.
10 stars 2 forks source link

Namespaced logger that Adam said he would like #35

Closed octatone closed 10 years ago

octatone commented 10 years ago

will write more tests, but this already works

WBLogger.log('io');
var ioLogger = new WBLogger('io');
var schemaLogger = new WBlogger('schema');

ioLogger.log('foobar');

foobar

schemaLogger.dir(someSchema); // (does nothing since log patter 'io' does not match 'schema')

Namespaced instances are cached a la the WL WBCollection.

octatone commented 10 years ago

@adamrenklint

netroy commented 10 years ago

why not create a new module for logging ?

octatone commented 10 years ago

Because I am not smart enough to figure out how to deal with the multiple wb.core dependencies :D Feel free to teach me.

octatone commented 10 years ago

Ideally we would use this everywhere, it does make sense to make a standalone module.

netroy commented 10 years ago

we can do this on monday .. i did some work on coloured prefixes that worked on node as well as browser, we can visit that again.

octatone commented 10 years ago

Cool, yeah, lets sit together and hack out a real module on monday and publish it.

adamrenklint commented 10 years ago

yay :smiley:

octatone commented 10 years ago

Is KartoffelScript a real thing @netroy or another troll module?

chad commented 10 years ago

Any interest in log levels ala https://github.com/jonnyreeves/js-logger/blob/master/src/logger.js ?

adamrenklint commented 10 years ago

ooops :/

octatone commented 10 years ago

Log levels would be good to add for node support.

adamrenklint commented 10 years ago

Maybe something like here? http://smalljs.org/logging/debug/

DEBUG=* node index.js
DEBUG=grep node index.js
octatone commented 10 years ago

Yeah we can add support for env variables, for setting the match pattern LOG=io

Debug doesn't make sense to me as although you might use this for literal debugging, it's just a wrapper for all console methods, including timing, info logging etc. It's more all purpose.

adamrenklint commented 10 years ago

Yeah, a LOG env variable makes more sense

octatone commented 10 years ago

Ze code ist mein!!!

Moved to here: https://github.com/octatone/MagiConsole