Given a service that uses @sendgrid/mail and a few other things, I'd like its logger output to be consistent, to make it easier to consume, aggregate, and send to a logs stream for indexing.
(For example, I may want each log entry to be a single line in JSON format (making stdout act like JSONL))
However, in some warning/error cases this SDK writes directly to console, so I can't change the output format?
This leads to "Unparsed logs" showing up in Datadog, looking like for example:
Content with characters ', " or & may need to be escaped with three brackets
{{{ content }}}
See https://sendgrid.com/docs/for-developers/sending-email/using-handlebars/ for more information.
Given a service that uses
@sendgrid/mailand a few other things, I'd like its logger output to be consistent, to make it easier to consume, aggregate, and send to a logs stream for indexing.(For example, I may want each log entry to be a single line in JSON format (making stdout act like JSONL))
However, in some warning/error cases this SDK writes directly to
console, so I can't change the output format?This leads to "Unparsed logs" showing up in Datadog, looking like for example: