Skip to content

Commit

Permalink
fix(public/tags): resets logger level after kpo calls
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed May 19, 2019
1 parent 7f35ad6 commit 83ed074
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/public/tags/kpo.ts
Expand Up @@ -4,7 +4,7 @@ import toArgv from 'string-argv';
import { splitBy } from 'cli-belt';
import main from '~/bin/main';
import { isSilentError } from '~/utils/errors';
import logger from '~/utils/logger';
import logger, { setLevel } from '~/utils/logger';

export default expose(kpo) as TExposedOverload<
typeof kpo,
Expand All @@ -30,9 +30,12 @@ function kpo(...args: any[]): (args?: string[]) => Promise<void> {
split[1] = split[1].concat(_argv || []);
if (split[1].length) argv = split[0].concat('--').concat(split[1]);

const level: any = logger.getLevel();
try {
await main(argv);
setLevel(level);
} catch (err) {
setLevel(level);
if (isSilentError(err)) {
logger.warn(err.message);
if (err.root.stack) logger.trace(err.root.stack);
Expand Down

0 comments on commit 83ed074

Please sign in to comment.