feat: address log level feedback

This commit is contained in:
Eli Bosley
2025-01-23 16:40:04 -05:00
parent cbb42dc85e
commit bb95795a31
2 changed files with 6 additions and 8 deletions

View File

@@ -12,6 +12,8 @@ export const levels = [
'fatal',
] as const;
export type LogLevel = typeof levels[number];
const level =
levels[
levels.indexOf(

View File

@@ -2,14 +2,11 @@ import { execa } from 'execa';
import { Command, CommandRunner, Option } from 'nest-commander';
import { ECOSYSTEM_PATH, PM2_PATH } from '@app/consts';
import { levels } from '@app/core/log';
import { levels, LogLevel } from '@app/core/log';
import { LogService } from '@app/unraid-api/cli/log.service';
interface StartCommandOptions {
debug?: boolean;
port?: string;
'log-level'?: string;
environment?: string;
}
@Command({ name: 'start' })
@@ -39,10 +36,9 @@ export class StartCommand extends CommandRunner {
@Option({
flags: `--log-level <${levels.join('|')}>`,
description: 'log level to use',
defaultValue: 'info',
})
parseLogLevel(val: string): typeof levels {
return (levels.includes(val as (typeof levels)[number])
? (val as (typeof levels)[number])
: 'info') as unknown as typeof levels;
parseLogLevel(val: string): LogLevel {
return levels.includes(val as LogLevel) ? (val as LogLevel) : 'info';
}
}