zksync-cli
Version:
CLI tool that simplifies the process of developing applications and interacting with the ZKsync network
25 lines • 934 B
JavaScript
import chalk from "chalk";
import { format, createLogger, transports } from "winston";
import { hasColor } from "./helpers.js";
export const errorSymbol = "ⓘ";
export const warningSymbol = "⚠";
const logLevelFormatter = {
error: (msg) => chalk.redBright(`${errorSymbol} ${msg}`),
warn: (msg) => chalk.yellowBright(`${warningSymbol} ${msg}`),
info: chalk.magentaBright,
debug: chalk.gray,
};
const styleLogs = format.printf((info) => {
if (hasColor(String(info.message)) || info.noFormat) {
return String(info.message);
}
const colorize = logLevelFormatter[info.level];
return colorize ? colorize(String(info.message)) : String(info.message);
});
const logger = createLogger({
level: process.env.NODE_ENV === "development" ? "debug" : "info",
format: format.combine(styleLogs),
transports: [new transports.Console()],
});
export default logger;
//# sourceMappingURL=logger.js.map