seanmonstar / intel

I need more intel!
http://seanmonstar.github.io/intel/
Mozilla Public License 2.0
202 stars 26 forks source link

improve intro in README #22

Closed seanmonstar closed 10 years ago

ShemTovYosef commented 10 years ago

Thank you for a good lib that provide necessary functionality and easy to use. Could you tell how to configure intel to handle all messages provided by 3d party library by root logger, i.e., socket.io is used in project and it logs all messages separately in console.

logger configuration here:

const intel = require('intel');
    intel.config({
        formatters: {
            'detailsConsole': {
                'format': '%(levelname)s [%(date)s] %(message)s',
                'colorize': true
            }
        },
        handlers: {
            'terminal': {
                'class': intel.handlers.Console,
                'formatter': 'detailsConsole',
                'level': intel.VERBOSE
            }
        },
        loggers: {
            'root': {
                'handlers': ['terminal', 'serverfile'],
                'level': 'INFO',
                'handleExceptions': true,
                'exitOnError': false,
                'propagate': false
            }
        }
    });

Thanks in advance!

seanmonstar commented 10 years ago

I have no idea what CFG does in that example. However, to capture logs from libraries using console.log, you should look at http://seanmonstar.github.io/intel/#console

It looks like the newest version of socket.io is using "debug", so you'd need to use the debug option, and call it BEFORE you require socket.io.

Example:

intel.console({
debug: "socket.io:*"
});

// afterwards ...
var io = require('socket.io');