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 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 6x 6x 6x 6x 6x 6x 14x 14x 14x 14x | import consola, { FancyReporter, JSONReporter } from "consola";
import { z } from "zod";
import { getFromEnv } from "../common/env";
import { isNodeRuntime } from "../common/runtime";
const DEFAULT_ENABLE_JSON_LOGS = true;
export const loggerFactory = (moduleName: string) => {
if (isNodeRuntime()) {
const enableJsonLogs = getFromEnv(
"ENABLE_JSON_LOGS",
z.boolean().default(DEFAULT_ENABLE_JSON_LOGS)
);
const mainReporter = enableJsonLogs
? new JSONReporter()
: new FancyReporter();
return consola
.create({
reporters: [mainReporter],
})
.withTag(moduleName);
} else E{
return console;
}
};
|