如何在nodejs的winston@3.0.0中的logger.log()文件中传递对象

时间:2018-07-19 15:01:56

标签: node.js logging winston

我在变量queryData = qs.parse(requestBody);中有一个http请求 当我尝试通过温斯顿解析时

logger.log("info","requestbody",+queryData);

甚至尝试过

logger.log("info","requestbody %s", queryData);
logger.log("info","requestbody",{queryData});

没用

出现类似以下错误:

{ TypeError:    Cannot create property 'Symbol(level)' on string 'Registering Device typeac'
    at DerivedLogger.log (/home/grl/www/node_modules/winston/lib/winston/logger.js:130:20)
    at createOcfRes (/home/aol/www/iot-node-server.js:285:10)
    at IncomingMessage.<anonymous> (/home/aol/www/iot-node-server.js:115:9)
    at emitNone (events.js:86:13)
    at IncomingMessage.emit (events.js:186:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9) level: 'error', timestamp: '19-07-2018 20:20:19' }

0 个答案:

没有答案