mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor: logging (#1318)
This commit is contained in:
parent
92ca447f33
commit
ba04b753de
6 changed files with 26 additions and 19 deletions
|
|
@ -27,6 +27,6 @@ export const immichAppConfig: ConfigModuleOptions = {
|
|||
JWT_SECRET: Joi.string().required().custom(jwtSecretValidator),
|
||||
DISABLE_REVERSE_GEOCODING: Joi.boolean().optional().valid(true, false).default(false),
|
||||
REVERSE_GEOCODING_PRECISION: Joi.number().optional().valid(0, 1, 2, 3).default(3),
|
||||
LOG_LEVEL: Joi.string().optional().valid('simple', 'verbose').default('simple'),
|
||||
LOG_LEVEL: Joi.string().optional().valid('simple', 'verbose', 'debug', 'log', 'warn', 'error').default('log'),
|
||||
}),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 './asset-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…
Add table
Add a link
Reference in a new issue