mirror of
https://github.com/immich-app/immich.git
synced 2025-12-29 09:14:59 +03:00
* run migrations after checks * optional migrations * only run checks in server and e2e * re-add migrations for microservices * refactor * move e2e init * remove assert from migration * update providers * update microservices app service * fixed logging * refactored version check, added unit tests * more version tests * don't use mocks for sut * refactor tests * suggest image only if postgres is 14, 15 or 16 * review suggestions * fixed regexp escape * fix typing * update migration
22 lines
756 B
TypeScript
22 lines
756 B
TypeScript
import { ConsoleLogger } from '@nestjs/common';
|
|
import { isLogLevelEnabled } from '@nestjs/common/services/utils/is-log-level-enabled.util';
|
|
import { LogLevel } from './entities';
|
|
|
|
const LOG_LEVELS = [LogLevel.VERBOSE, LogLevel.DEBUG, LogLevel.LOG, LogLevel.WARN, LogLevel.ERROR, LogLevel.FATAL];
|
|
|
|
export class ImmichLogger extends ConsoleLogger {
|
|
private static logLevels: LogLevel[] = [LogLevel.WARN, LogLevel.ERROR, LogLevel.FATAL];
|
|
|
|
constructor(context: string) {
|
|
super(context);
|
|
}
|
|
|
|
isLevelEnabled(level: LogLevel) {
|
|
return isLogLevelEnabled(level, ImmichLogger.logLevels);
|
|
}
|
|
|
|
static setLogLevel(level: LogLevel | false): void {
|
|
ImmichLogger.logLevels = level === false ? [] : LOG_LEVELS.slice(LOG_LEVELS.indexOf(level));
|
|
}
|
|
}
|