diff --git a/src/utils/logger.ts b/src/utils/logger.ts index cd58b1b..0136670 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -2,12 +2,14 @@ import loglevel from 'loglevel'; import chalk, { Chalk } from 'chalk'; import { DEFAULT_LOG_LEVEL } from '~/constants'; import { TLogger } from '~/types'; +import { options } from 'exits'; const APP_NAME = 'kpo'; const logger = loglevel.getLogger(`_${APP_NAME}_logger_`); function setLevel(level: TLogger): void { logger.setLevel(level); + options({ logger: level }); } const colors: { [key in TLogger]?: Chalk } = { @@ -39,5 +41,6 @@ logger.methodFactory = (...args) => (...inner: any[]) => { // Must be set -at least once- after overwriting methodFactory logger.setDefaultLevel(DEFAULT_LOG_LEVEL); +options({ logger: DEFAULT_LOG_LEVEL }); export { logger as default, setLevel };