Pay attention to the log level

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the workflows category.

Last Updated: 2022-12-01

Having just started as an external consultant at M, I contacted one of their teammates asking about two "errors" in the logs. In fact there were two entries in the logs and only one of them was an error.

{
 "customData":{
    "console":true,
    "loggly":false
 },
 "location":"backend-logger:Logger",
 "message":"Set up logger",
 "name":"LoggerInit",
 "level":"info"
}{
 "message":"connectDatabase failed at event sorcerer with the following error: role \"user\" does not exist",
 "error":{
    "name":"error",
    "length":96,
    "severity":"FATAL",
    "code":"28000",
    "file":"miscinit.c",
    "line":"607",
    "routine":"InitializeSessionUserId",
    "message":"role \"user\" does not exist",
    "stack":"error: role \"user\" does not exist\n    at Connection.parseE (/Users/jack/code/consulting/mieterengel/event-sorcerer/node_modules/pg/lib/connection.js:604:11)\n    at Connection.parseMessage (/Users/jack/code/consulting/mieterengel/event-sorcerer/node_modules/pg/lib/connection.js:401:19)\n    at Socket.<anonymous> (/Users/jack/code/consulting/mieterengel/event-sorcerer/node_modules/pg/lib/connection.js:121:22)\n    at Socket.emit (events.js:209:13)\n    at Socket.EventEmitter.emit (domain.js:499:23)\n    at addChunk (_stream_readable.js:305:12)\n    at readableAddChunk (_stream_readable.js:286:11)\n    at Socket.Readable.push (_stream_readable.js:220:10)\n    at TCP.onStreamRead (internal/stream_base_commons.js:166:17)"
 },
 "name":"ErrorConnectingToDatabase",
 "stack":"ErrorConnectingToDatabase: connectDatabase failed at event sorcerer with the following error: role \"user\" does not exist\n    at connectDatabase (/Users/jack/code/consulting/mieterengel/event-sorcerer/.webpack/service/src/webpack:/src/Database/Database.ts:29:26)\n    at processTicksAndRejections (internal/process/task_queues.js:85:5)",
 "level":"warn"
}

This led him to get understandably defensive, correcting me. I should have looked at the log level keys first and seen that the one about the logger was only "info" and could be interpreted as business as usual and that there was only one error.