You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/docker/helpers/logHelper/concatLogsToString.ts

16 lines
371 B

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,
''
);
}