You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To enable this feature, I'd have to wrap the record that writes out with the following:
const span = tracer.scope().active();
const time = new Date().toISOString();
const record = { time, level, message };
if (span) {
tracer.inject(span.context(), formats.LOG, record);
}
Based on reading the roarr docs, it seems I'd want to inject this in the child logger function / create middleware?
The text was updated successfully, but these errors were encountered:
Depends. If you want all your logs (e.g. those included by some dependencies that use roarr) then your better option is to extend ROARR.write. Something like this:
import{ROARR,}from'roarr';constmain=()=>{constoldWrite=ROARR.write;ROARR.write=(message)=>{constspan=tracer.scope().active();consttime=newDate().toISOString();constrecord={ time, level, message };if(span){tracer.inject(span.context(),formats.LOG,record);}oldWrite(message);};};
If you only care about the logs produced directly by your application, then middleware is sufficient.
According to:
https://docs.datadoghq.com/tracing/connect_logs_and_traces/nodejs/
To enable this feature, I'd have to wrap the record that writes out with the following:
Based on reading the
roarr
docs, it seems I'd want to inject this in the child logger function / create middleware?The text was updated successfully, but these errors were encountered: