tblobaum / rconsole

"syslog.h" bindings for node.js with a revised console module
MIT License
54 stars 10 forks source link

an error about console.dir() #8

Open biebg opened 10 years ago

biebg commented 10 years ago

ubuntu 14.04 express 3.5 rconsole 0.2.0

my code

var express = require('express');
var routes = require('./routes');
var user = require('./routes/user');
var http = require('http');
var path = require('path');
require('rconsole');
var app = express();
console.set({
    facility: 'local0'      // default: user
    , title: 'web-01'       // default: node -- can also be set with `process.title`
    , highestLevel: 'debug'  // [emerg, alert, crit, err, warning, notice, info, debug]
    , stdout: false         // default: false
    , stderr: true          // default: true
    , syslog: true          // default: true
    , syslogHashTags: false // default: false
    , showTime: true        // default: true
    , showLine: true        // default: true
    , showFile: true        // default: true
    , showTags: true        // default: true
})

// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(express.cookieParser('your secret here'));
app.use(express.session());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

app.get('/',function(req,res){
    console.emerg('level 0');

    console.alert('level 1');

    console.crit('level 2');

    console.error('level 3');

    console.warn('level 4');

    console.notice('level 5');

    console.info('level 6');
    console.log('level 6');

    console.debug('level 7', { hello: 'world' });
    console.trace('level 7');
    console.dir({ 'level 7': { 'deep': { 'level': { 'inspect': true } } } }, true, 5);
    console.time('level 7');
    console.timeEnd('level 7');
    res.send({code:0})
});
app.get('/users', user.list);

http.createServer(app).listen(app.get('port'), function(){
  console.log('Express server listening on port ' + app.get('port'));
});

my err

emerg 04-24 03:02 [app.js:47] level 0
 alert 04-24 03:02 [app.js:49] level 1
  crit 04-24 03:02 [app.js:51] level 2
 error 04-24 03:02 [app.js:53] level 3
  warn 04-24 03:02 [app.js:55] level 4
notice 04-24 03:02 [app.js:57] level 5
  info 04-24 03:02 [app.js:59] level 6
  info 04-24 03:02 [app.js:60] level 6
 debug 04-24 03:02 [app.js:62] level 7 { hello: 'world' }
 trace 04-24 03:02 [app.js:63] level 7
    at /home/yuansc/rconsoleDemo/app.js:63:13
    at callbacks (/home/yuansc/rconsoleDemo/node_modules/express/lib/router/index.js:164:37)
    at param (/home/yuansc/rconsoleDemo/node_modules/express/lib/router/index.js:138:11)
    at pass (/home/yuansc/rconsoleDemo/node_modules/express/lib/router/index.js:145:5)
    at Router._dispatch (/home/yuansc/rconsoleDemo/node_modules/express/lib/router/index.js:173:5)
    at Object.router (/home/yuansc/rconsoleDemo/node_modules/express/lib/router/index.js:33:10)
    at next (/home/yuansc/rconsoleDemo/node_modules/express/node_modules/connect/lib/proto.js:193:15)
    at /home/yuansc/rconsoleDemo/node_modules/express/node_modules/connect/node_modules/express-session/index.js:350:9
    at Object._onImmediate (/home/yuansc/rconsoleDemo/node_modules/express/node_modules/connect/node_modules/express-session/session/memory.js:50:9)
    at processImmediate [as _immediateCallback] (timers.js:330:15)
   dir 04-24 03:02 [app.js:64] { 'level 7': { deep: { level: { inspect: true } } } }
  time 04-24 03:02 [app.js:65] level 7
timeEnd 04-24 03:02 [app.js:66] level 7: 0ms