Merge pull request #2352 from balena-os/optimize-logs

Optimize logs
This commit is contained in:
Page- 2024-07-16 23:27:30 +01:00 committed by GitHub
commit cafd8e89e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -88,22 +88,17 @@ export class BalenaLogBackend extends LogBackend {
return;
}
message = Object.assign(
{
timestamp: Date.now(),
message: '',
},
message,
);
if (!message.isSystem && message.serviceId == null) {
return;
}
message.message = _.truncate(message.message, {
length: MAX_LOG_LENGTH,
omission: '[...]',
});
message.timestamp ??= Date.now();
message.message = message.message
? _.truncate(message.message, {
length: MAX_LOG_LENGTH,
omission: '[...]',
})
: '';
this.write(message);
}