All files log.ts

83.33% Statements 10/12
25% Branches 1/4
100% Functions 1/1
83.33% Lines 10/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 141x 1x   1x 62x 62x 62x 62x 62x     62x 62x  
import consola from "consola";
import { type Config, getConfig } from "./config";
 
export function getLogger(name?: string) {
  let config: Config | undefined;
  try {
    config = getConfig();
  } catch (e) {}
  for (const reporter of config?.logger?.reporters ?? []) {
    consola.addReporter(reporter);
  }
  return name ? consola.withTag(name) : consola;
}