mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
feat: address log level feedback
This commit is contained in:
@@ -12,6 +12,8 @@ export const levels = [
|
||||
'fatal',
|
||||
] as const;
|
||||
|
||||
export type LogLevel = typeof levels[number];
|
||||
|
||||
const level =
|
||||
levels[
|
||||
levels.indexOf(
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user