Skip to content

SudoSOS Back-end API / internal/helpers / flattenLogData

Function: flattenLogData() ​

ts
function flattenLogData(data): object;

Split the arguments of a log call into its message and its fields. The first string that was logged becomes the message, plain objects are merged into the fields, and everything else ends up under args. Both log('msg', { field }) and log({ field }, 'msg') are therefore understood.

Parameters ​

ParameterTypeDescription
dataunknown[]the arguments that were passed to the log call.

Returns ​

object

fields ​

ts
fields: Record<string, unknown>;

msg ​

ts
msg: string;