How to use strong-log-transformer - 2 common examples

To help you get started, we’ve selected a few strong-log-transformer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / kibana / packages / kbn-pm / src / utils / child_process.ts View on Github external
export function spawnStreaming(
  command: string,
  args: string[],
  opts: execa.Options,
  { prefix }: { prefix: string }
) {
  const spawned = execa(command, args, {
    stdio: ['ignore', 'pipe', 'pipe'],
    ...opts,
  });

  const color = nextColor();
  const prefixedStdout = logTransformer({ tag: `${color.bold(prefix)}:` });
  const prefixedStderr = logTransformer({
    mergeMultiline: true,
    tag: `${logSymbols.error} ${color.bold(prefix)}:`,
  });

  spawned.stdout.pipe(prefixedStdout).pipe(process.stdout);
  spawned.stderr.pipe(prefixedStderr).pipe(process.stderr);

  return spawned;
}
github elastic / kibana / packages / kbn-pm / src / utils / child_process.ts View on Github external
export function spawnStreaming(
  command: string,
  args: string[],
  opts: execa.Options,
  { prefix }: { prefix: string }
) {
  const spawned = execa(command, args, {
    stdio: ['ignore', 'pipe', 'pipe'],
    ...opts,
  });

  const color = nextColor();
  const prefixedStdout = logTransformer({ tag: `${color.bold(prefix)}:` });
  const prefixedStderr = logTransformer({
    mergeMultiline: true,
    tag: `${logSymbols.error} ${color.bold(prefix)}:`,
  });

  spawned.stdout.pipe(prefixedStdout).pipe(process.stdout);
  spawned.stderr.pipe(prefixedStderr).pipe(process.stderr);

  return spawned;
}

strong-log-transformer

Stream transformer that prefixes lines with timestamps and other things.

Apache-2.0
Latest version published 6 years ago

Package Health Score

71 / 100
Full package analysis

Popular strong-log-transformer functions