1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-21 06:19:41 +02:00
portainer/app/docker/helpers/logHelper/concatLogsToString.ts
andres-portainer 535a26412f
fix(logging): default to pretty logging [EE-4371] (#7847)
* fix(logging): default to pretty logging EE-4371

* feat(app/logs): prettify stack traces in JSON logs

* feat(nomad/logs): prettify JSON logs in log viewer

* feat(kubernetes/logs): prettigy JSON logs in log viewers

* feat(app/logs): format and color zerolog prettified logs

* fix(app/logs): pre-parse logs when they are double serialized

Co-authored-by: andres-portainer <andres-portainer@users.noreply.github.com>
Co-authored-by: LP B <xAt0mZ@users.noreply.github.com>
2022-10-20 16:33:54 +02:00

15 lines
371 B
TypeScript

import { NEW_LINE_BREAKER } from '@/constants';
import { FormattedLine } from './types';
type FormatFunc = (line: FormattedLine) => string;
export function concatLogsToString(
logs: FormattedLine[],
formatFunc: FormatFunc = (line) => line.line
) {
return logs.reduce(
(acc, formattedLine) => acc + formatFunc(formattedLine) + NEW_LINE_BREAKER,
''
);
}