@storm-software/config-tools
Version:
⚡The Storm-Ops monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.
45 lines (42 loc) • 1.15 kB
JavaScript
import {
getLogFn,
getStopwatch
} from "./chunk-XDS6C7HI.js";
import {
findWorkspaceRoot
} from "./chunk-K6PUXRK3.js";
import {
LogLevel
} from "./chunk-3QAWRU2B.js";
import {
__name
} from "./chunk-SHUYVCID.js";
// src/logger/create-logger.ts
import chalk from "chalk";
async function createLogger(config) {
const workspaceRoot = findWorkspaceRoot();
if (!workspaceRoot) {
throw new Error("Cannot find workspace root");
}
const writeFatal = getLogFn(LogLevel.FATAL, config, chalk);
const writeError = getLogFn(LogLevel.ERROR, config, chalk);
const writeWarning = getLogFn(LogLevel.WARN, config, chalk);
const writeInfo = getLogFn(LogLevel.INFO, config, chalk);
const writeSuccess = getLogFn(LogLevel.SUCCESS, config, chalk);
const writeDebug = getLogFn(LogLevel.DEBUG, config, chalk);
const writeTrace = getLogFn(LogLevel.DEBUG, config, chalk);
return {
fatal: writeFatal,
error: writeError,
warning: writeWarning,
info: writeInfo,
success: writeSuccess,
debug: writeDebug,
trace: writeTrace,
getStopwatch
};
}
__name(createLogger, "createLogger");
export {
createLogger
};