mirror of https://github.com/immich-app/immich.git
refactor: logging (#1318)
parent
92ca447f33
commit
ba04b753de
@ -1,4 +0,0 @@
|
|||||||
export enum ImmichLogLevel {
|
|
||||||
SIMPLE = 'simple',
|
|
||||||
VERBOSE = 'verbose',
|
|
||||||
}
|
|
||||||
@ -1,3 +1,15 @@
|
|||||||
|
import { LogLevel } from '@nestjs/common';
|
||||||
|
|
||||||
export * from './time-utils';
|
export * from './time-utils';
|
||||||
export * from './asset-utils';
|
export * from './asset-utils';
|
||||||
export * from './user-utils';
|
export * from './user-utils';
|
||||||
|
|
||||||
|
export function getLogLevels() {
|
||||||
|
const LOG_LEVELS: LogLevel[] = ['verbose', 'debug', 'log', 'warn', 'error'];
|
||||||
|
let logLevel = process.env.LOG_LEVEL || 'log';
|
||||||
|
if (logLevel === 'simple') {
|
||||||
|
logLevel = 'log';
|
||||||
|
}
|
||||||
|
const logLevelIndex = LOG_LEVELS.indexOf(logLevel as LogLevel);
|
||||||
|
return logLevelIndex === -1 ? [] : LOG_LEVELS.slice(logLevelIndex);
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue