membership-system icon indicating copy to clipboard operation
membership-system copied to clipboard

req.log does not work if an object is not passed to it

Open naxxfish opened this issue 6 years ago • 0 comments

If you try to call req.log.info with a string instead of an object, it fails

TypeError: Cannot set property '_user' of undefined
    at logAThing (/usr/src/app/src/js/logging.js:88:27)
    at Object.info (/usr/src/app/src/js/logging.js:112:4)
    at /usr/src/app/apps/home/app.js:13:10
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/src/app/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/usr/src/app/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at /usr/src/app/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
    at next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)
    at expressInit (/usr/src/app/node_modules/express/lib/middleware/init.js:40:5)
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:317:13)
    at /usr/src/app/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
    at next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)

Should probably build a special case in, so that if a string is passed to one of these messages an object is created with the string as the msg field.

naxxfish avatar Apr 30 '18 09:04 naxxfish