Error in configuring Stormpath logger
Hi,
Stormpath fails to use my (simplified) logging module:
logger.js:
module.exports = require('winston');
app.js:
var logger = require('./lib/utils/logger'); app.use(stormpath.init(app, { logger: logger, ....
I get the following error: TypeError: b.hasOwnProperty is not a function at extend (/foo/node_modules/stormpath-config/node_modules/cloneextend/index.js:53:9)
Thanks, Matti
Hi Matti, you won't be able to pass the Winston module directly. You need to create a Winston logger instance, configure it, then pass it to our library. For example:
var myLogger = new winston.Logger({ /* your winston options */});
app.use(stormpath.init(app, {
logger: myLogger
}));
From the docs: http://docs.stormpath.com/nodejs/express/latest/configuration.html#logging
Hi, With this I get the same error. Should this work though?
logger.js:
module.exports = new winston.Logger({
level: 'info',
transports: [
new (winston.transports.Console)()
]
});
app.js:
var myLogger = require('./lib/utils/logger');
app.use(stormpath.init(app, {
logger: myLogger
}));
Thanks, Matti
same