Logs: only truncate the message if it's possible it will need it

Change-type: patch
This commit is contained in:
Pagan Gazzard 2024-07-16 18:01:10 +01:00 committed by Felipe Lalanne
parent 34cf8b6708
commit c5d0eafea9

View File

@ -93,12 +93,12 @@ export class BalenaLogBackend extends LogBackend {
} }
message.timestamp ??= Date.now(); message.timestamp ??= Date.now();
message.message ??= ''; message.message = message.message
? _.truncate(message.message, {
message.message = _.truncate(message.message, { length: MAX_LOG_LENGTH,
length: MAX_LOG_LENGTH, omission: '[...]',
omission: '[...]', })
}); : '';
this.write(message); this.write(message);
} }