@storm-software/config-tools
Version:
A package containing various utilities to support custom workspace configurations and environment management for Storm Software projects, including configuration file handling, environment variable management, and logging utilities.
41 lines (38 loc) • 1.06 kB
JavaScript
import {
getLogFn,
getStopwatch
} from "./chunk-SMVSQFZ3.js";
import {
findWorkspaceRoot
} from "./chunk-PTHGOJU6.js";
import {
LogLevel
} from "./chunk-POXTJ6GF.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
};
}
export {
createLogger
};