We are using Bunyan
lib for aws lambda function for cloud watch.
I am observing , when I print Bunyan logger with status error
, it is printing error format as follows
{
"name": "test-abc",
"serviceID": ".......................",
"requestID": "........................",
"hostname": "................",
"pid": 8,
"function": "_testStore",
"level": 50,
"msg": "store_id is missing",
"time": "2020-11-16T19:17:41.109Z",
"v": 0
}
while, when I log the error using console.error
function , I am getting error log in the below format
2020-11-16 13:41:27.357 (-06:00) a..... ERROR store_id is missing
As ERROR
logLevel tag in cloud watch help , to generate cloud error matrix, how could I use Bunyan for the same to print ERROR
tag before the JSON object.
Buyan format uses level as a decimal number where level error
means 50
.
Please check the official documentation: https://github.com/trentm/node-bunyan#levels