@storm-stack/cli
Advanced tools
Comparing version 1.14.2 to 1.14.3
@@ -1308,5 +1308,7 @@ /// <reference types="node" /> | ||
"logging", | ||
LoggingConfigSchema | ||
LoggingConfigSchema, | ||
); | ||
StormLog.logger = StormLog.initialize(config as StormConfig<"logging", LoggingConfig>); | ||
StormLog.logger = StormLog.initialize( | ||
config as StormConfig<"logging", LoggingConfig>, | ||
); | ||
StormLog.logLevel = getLogLevel(config.logLevel); | ||
@@ -1319,3 +1321,3 @@ StormLog.logLevelLabel = config.logLevel; | ||
logLevel: StormLog.logLevel, | ||
logLevelLabel: StormLog.logLevelLabel | ||
logLevelLabel: StormLog.logLevelLabel, | ||
}; | ||
@@ -1333,3 +1335,3 @@ }; | ||
config: StormConfig<"logging", LoggingConfig>, | ||
name?: string | ||
name?: string, | ||
): Logger<LoggerOptions> => { | ||
@@ -1357,3 +1359,3 @@ const pinoLogger: Logger<LoggerOptions> = getPinoLogger(config, name); | ||
name?: string, | ||
additionalLoggers: ILoggerWrapper[] = [] | ||
additionalLoggers: ILoggerWrapper[] = [], | ||
) { | ||
@@ -1383,3 +1385,3 @@ this.#config = config; | ||
name?: string, | ||
additionalLoggers: ILoggerWrapper[] = [] | ||
additionalLoggers: ILoggerWrapper[] = [], | ||
) { | ||
@@ -1397,3 +1399,4 @@ return new StormLog(config, name, additionalLoggers); | ||
StormLog.getLoggers().then((logger) => { | ||
StormLog.logLevel >= LogLevel.INFO && logger.info({ msg: message, level: "success" }); | ||
StormLog.logLevel >= LogLevel.INFO && | ||
logger.info({ msg: message, level: "success" }); | ||
}); | ||
@@ -1412,3 +1415,4 @@ } | ||
StormLog.getLoggers().then((logger) => { | ||
StormLog.logLevel >= LogLevel.FATAL && logger.fatal({ error, level: "fatal" }); | ||
StormLog.logLevel >= LogLevel.FATAL && | ||
logger.fatal({ error, level: "fatal" }); | ||
}); | ||
@@ -1427,3 +1431,4 @@ } | ||
StormLog.getLoggers().then((logger) => { | ||
StormLog.logLevel >= LogLevel.ERROR && logger.error({ error, level: "error" }); | ||
StormLog.logLevel >= LogLevel.ERROR && | ||
logger.error({ error, level: "error" }); | ||
}); | ||
@@ -1442,3 +1447,4 @@ } | ||
StormLog.getLoggers().then((logger) => { | ||
StormLog.logLevel >= LogLevel.ERROR && logger.error({ error, level: "exception" }); | ||
StormLog.logLevel >= LogLevel.ERROR && | ||
logger.error({ error, level: "exception" }); | ||
}); | ||
@@ -1516,5 +1522,5 @@ } | ||
logger.info( | ||
`⏱️ The${name ? ` ${name}` : ""} process took ${formatSince( | ||
startTime.since() | ||
)} to complete` | ||
`⏱️ The${name ? ` ${name}` : ""} process took ${formatSince(startTime.since())} to complete | ||
`, | ||
); | ||
@@ -1533,3 +1539,5 @@ }); | ||
this.#logger.info({ msg: message, level: "success" }); | ||
Promise.all(this.#additionalLoggers.map((logger) => logger.success(message))); | ||
Promise.all( | ||
this.#additionalLoggers.map((logger) => logger.success(message)), | ||
); | ||
} | ||
@@ -1579,3 +1587,5 @@ } | ||
this.#logger.error({ error, level: "exception" }); | ||
Promise.all(this.#additionalLoggers.map((logger) => logger.exception(error))); | ||
Promise.all( | ||
this.#additionalLoggers.map((logger) => logger.exception(error)), | ||
); | ||
} | ||
@@ -1593,3 +1603,5 @@ } | ||
this.#logger.warn(message); | ||
Promise.all(this.#additionalLoggers.map((logger) => logger.warn(message))); | ||
Promise.all( | ||
this.#additionalLoggers.map((logger) => logger.warn(message)), | ||
); | ||
} | ||
@@ -1607,3 +1619,5 @@ } | ||
this.#logger.info(message); | ||
Promise.all(this.#additionalLoggers.map((logger) => logger.info(message))); | ||
Promise.all( | ||
this.#additionalLoggers.map((logger) => logger.info(message)), | ||
); | ||
} | ||
@@ -1621,3 +1635,5 @@ } | ||
this.#logger.debug(message); | ||
Promise.all(this.#additionalLoggers.map((logger) => logger.debug(message))); | ||
Promise.all( | ||
this.#additionalLoggers.map((logger) => logger.debug(message)), | ||
); | ||
} | ||
@@ -1635,3 +1651,5 @@ } | ||
this.#logger.trace(message); | ||
Promise.all(this.#additionalLoggers.map((logger) => logger.trace(message))); | ||
Promise.all( | ||
this.#additionalLoggers.map((logger) => logger.trace(message)), | ||
); | ||
} | ||
@@ -1682,7 +1700,11 @@ } | ||
if (!_startTime && !this.#processes.some((item) => item.name === name)) { | ||
this.warn(`No start time was provided and the ${name} process was never started`); | ||
this.warn( | ||
`No start time was provided and the ${name} process was never started`, | ||
); | ||
return; | ||
} | ||
if (name && this.#processes.some((item) => item.name === name)) { | ||
_startTime = this.#processes.find((item) => item.name === name)?.startedAt; | ||
_startTime = this.#processes.find( | ||
(item) => item.name === name, | ||
)?.startedAt; | ||
} | ||
@@ -1700,3 +1722,3 @@ | ||
0, | ||
this.#processes.findIndex((item) => item.name === process) | ||
this.#processes.findIndex((item) => item.name === process), | ||
) | ||
@@ -1707,4 +1729,4 @@ .join(" > "); | ||
const message = `${ | ||
process ? `Completed process: ${process}` : "The process has completed" | ||
} \n\n⏱️ Process took ${_startTime ? formatSince(_startTime.since()) : "0ms"} to complete`; | ||
process ? `⏱️ Completed process ${process}` : "The process has completed" | ||
} in ${_startTime ? formatSince(_startTime.since()) : "0ms"}\n\n`; | ||
@@ -1728,3 +1750,7 @@ this.#logger.info(message); | ||
public child(options: { name: string } & Record<string, any>): IStormLog { | ||
return new StormLog(this.#config, `${this.#name} ❯ ${options?.name}`, this.#additionalLoggers); | ||
return new StormLog( | ||
this.#config, | ||
`${this.#name} ❯ ${options?.name}`, | ||
this.#additionalLoggers, | ||
); | ||
} | ||
@@ -1750,3 +1776,5 @@ | ||
if (logger) { | ||
this.addWrappedLogger(LoggerWrapper.wrap(logger, this.#config.modules?.logging)); | ||
this.addWrappedLogger( | ||
LoggerWrapper.wrap(logger, this.#config.modules?.logging), | ||
); | ||
} | ||
@@ -1753,0 +1781,0 @@ } |
{ | ||
"name": "@storm-stack/cli", | ||
"version": "1.14.2", | ||
"version": "1.14.3", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "A collection of CLI utilities to assist in creating command line applications.", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
331532
1728