feat(web,server)!: runtime log level (#5672)

* feat: change log level at runtime

* chore: open api

* chore: prefer env over runtime

* chore: remove default env value
This commit is contained in:
Jason Rasmussen
2023-12-14 16:55:40 +00:00
committed by GitHub
parent f2270ad757
commit 9768931275
61 changed files with 771 additions and 117 deletions
+45
View File
@@ -2175,6 +2175,24 @@ export const LibraryType = {
export type LibraryType = typeof LibraryType[keyof typeof LibraryType];
/**
*
* @export
* @enum {string}
*/
export const LogLevel = {
Verbose: 'verbose',
Debug: 'debug',
Log: 'log',
Warn: 'warn',
Error: 'error',
Fatal: 'fatal'
} as const;
export type LogLevel = typeof LogLevel[keyof typeof LogLevel];
/**
*
* @export
@@ -3577,6 +3595,12 @@ export interface SystemConfigDto {
* @memberof SystemConfigDto
*/
'library': SystemConfigLibraryDto;
/**
*
* @type {SystemConfigLoggingDto}
* @memberof SystemConfigDto
*/
'logging': SystemConfigLoggingDto;
/**
*
* @type {SystemConfigMachineLearningDto}
@@ -3860,6 +3884,27 @@ export interface SystemConfigLibraryScanDto {
*/
'enabled': boolean;
}
/**
*
* @export
* @interface SystemConfigLoggingDto
*/
export interface SystemConfigLoggingDto {
/**
*
* @type {boolean}
* @memberof SystemConfigLoggingDto
*/
'enabled': boolean;
/**
*
* @type {LogLevel}
* @memberof SystemConfigLoggingDto
*/
'level': LogLevel;
}
/**
*
* @export
+6
View File
@@ -82,6 +82,7 @@ doc/LibraryApi.md
doc/LibraryResponseDto.md
doc/LibraryStatsResponseDto.md
doc/LibraryType.md
doc/LogLevel.md
doc/LoginCredentialDto.md
doc/LoginResponseDto.md
doc/LogoutResponseDto.md
@@ -142,6 +143,7 @@ doc/SystemConfigFFmpegDto.md
doc/SystemConfigJobDto.md
doc/SystemConfigLibraryDto.md
doc/SystemConfigLibraryScanDto.md
doc/SystemConfigLoggingDto.md
doc/SystemConfigMachineLearningDto.md
doc/SystemConfigMapDto.md
doc/SystemConfigNewVersionCheckDto.md
@@ -274,6 +276,7 @@ lib/model/job_status_dto.dart
lib/model/library_response_dto.dart
lib/model/library_stats_response_dto.dart
lib/model/library_type.dart
lib/model/log_level.dart
lib/model/login_credential_dto.dart
lib/model/login_response_dto.dart
lib/model/logout_response_dto.dart
@@ -327,6 +330,7 @@ lib/model/system_config_f_fmpeg_dto.dart
lib/model/system_config_job_dto.dart
lib/model/system_config_library_dto.dart
lib/model/system_config_library_scan_dto.dart
lib/model/system_config_logging_dto.dart
lib/model/system_config_machine_learning_dto.dart
lib/model/system_config_map_dto.dart
lib/model/system_config_new_version_check_dto.dart
@@ -439,6 +443,7 @@ test/library_api_test.dart
test/library_response_dto_test.dart
test/library_stats_response_dto_test.dart
test/library_type_test.dart
test/log_level_test.dart
test/login_credential_dto_test.dart
test/login_response_dto_test.dart
test/logout_response_dto_test.dart
@@ -499,6 +504,7 @@ test/system_config_f_fmpeg_dto_test.dart
test/system_config_job_dto_test.dart
test/system_config_library_dto_test.dart
test/system_config_library_scan_dto_test.dart
test/system_config_logging_dto_test.dart
test/system_config_machine_learning_dto_test.dart
test/system_config_map_dto_test.dart
test/system_config_new_version_check_dto_test.dart
+2
View File
@@ -281,6 +281,7 @@ Class | Method | HTTP request | Description
- [LibraryResponseDto](doc//LibraryResponseDto.md)
- [LibraryStatsResponseDto](doc//LibraryStatsResponseDto.md)
- [LibraryType](doc//LibraryType.md)
- [LogLevel](doc//LogLevel.md)
- [LoginCredentialDto](doc//LoginCredentialDto.md)
- [LoginResponseDto](doc//LoginResponseDto.md)
- [LogoutResponseDto](doc//LogoutResponseDto.md)
@@ -334,6 +335,7 @@ Class | Method | HTTP request | Description
- [SystemConfigJobDto](doc//SystemConfigJobDto.md)
- [SystemConfigLibraryDto](doc//SystemConfigLibraryDto.md)
- [SystemConfigLibraryScanDto](doc//SystemConfigLibraryScanDto.md)
- [SystemConfigLoggingDto](doc//SystemConfigLoggingDto.md)
- [SystemConfigMachineLearningDto](doc//SystemConfigMachineLearningDto.md)
- [SystemConfigMapDto](doc//SystemConfigMapDto.md)
- [SystemConfigNewVersionCheckDto](doc//SystemConfigNewVersionCheckDto.md)
+14
View File
@@ -0,0 +1,14 @@
# openapi.model.LogLevel
## Load the model package
```dart
import 'package:openapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+1
View File
@@ -11,6 +11,7 @@ Name | Type | Description | Notes
**ffmpeg** | [**SystemConfigFFmpegDto**](SystemConfigFFmpegDto.md) | |
**job** | [**SystemConfigJobDto**](SystemConfigJobDto.md) | |
**library_** | [**SystemConfigLibraryDto**](SystemConfigLibraryDto.md) | |
**logging** | [**SystemConfigLoggingDto**](SystemConfigLoggingDto.md) | |
**machineLearning** | [**SystemConfigMachineLearningDto**](SystemConfigMachineLearningDto.md) | |
**map** | [**SystemConfigMapDto**](SystemConfigMapDto.md) | |
**newVersionCheck** | [**SystemConfigNewVersionCheckDto**](SystemConfigNewVersionCheckDto.md) | |
+16
View File
@@ -0,0 +1,16 @@
# openapi.model.SystemConfigLoggingDto
## Load the model package
```dart
import 'package:openapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**enabled** | **bool** | |
**level** | [**LogLevel**](LogLevel.md) | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+2
View File
@@ -117,6 +117,7 @@ part 'model/job_status_dto.dart';
part 'model/library_response_dto.dart';
part 'model/library_stats_response_dto.dart';
part 'model/library_type.dart';
part 'model/log_level.dart';
part 'model/login_credential_dto.dart';
part 'model/login_response_dto.dart';
part 'model/logout_response_dto.dart';
@@ -170,6 +171,7 @@ part 'model/system_config_f_fmpeg_dto.dart';
part 'model/system_config_job_dto.dart';
part 'model/system_config_library_dto.dart';
part 'model/system_config_library_scan_dto.dart';
part 'model/system_config_logging_dto.dart';
part 'model/system_config_machine_learning_dto.dart';
part 'model/system_config_map_dto.dart';
part 'model/system_config_new_version_check_dto.dart';
+4
View File
@@ -321,6 +321,8 @@ class ApiClient {
return LibraryStatsResponseDto.fromJson(value);
case 'LibraryType':
return LibraryTypeTypeTransformer().decode(value);
case 'LogLevel':
return LogLevelTypeTransformer().decode(value);
case 'LoginCredentialDto':
return LoginCredentialDto.fromJson(value);
case 'LoginResponseDto':
@@ -427,6 +429,8 @@ class ApiClient {
return SystemConfigLibraryDto.fromJson(value);
case 'SystemConfigLibraryScanDto':
return SystemConfigLibraryScanDto.fromJson(value);
case 'SystemConfigLoggingDto':
return SystemConfigLoggingDto.fromJson(value);
case 'SystemConfigMachineLearningDto':
return SystemConfigMachineLearningDto.fromJson(value);
case 'SystemConfigMapDto':
+3
View File
@@ -88,6 +88,9 @@ String parameterToString(dynamic value) {
if (value is LibraryType) {
return LibraryTypeTypeTransformer().encode(value).toString();
}
if (value is LogLevel) {
return LogLevelTypeTransformer().encode(value).toString();
}
if (value is MapTheme) {
return MapThemeTypeTransformer().encode(value).toString();
}
+97
View File
@@ -0,0 +1,97 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class LogLevel {
/// Instantiate a new enum with the provided [value].
const LogLevel._(this.value);
/// The underlying value of this enum member.
final String value;
@override
String toString() => value;
String toJson() => value;
static const verbose = LogLevel._(r'verbose');
static const debug = LogLevel._(r'debug');
static const log = LogLevel._(r'log');
static const warn = LogLevel._(r'warn');
static const error = LogLevel._(r'error');
static const fatal = LogLevel._(r'fatal');
/// List of all possible values in this [enum][LogLevel].
static const values = <LogLevel>[
verbose,
debug,
log,
warn,
error,
fatal,
];
static LogLevel? fromJson(dynamic value) => LogLevelTypeTransformer().decode(value);
static List<LogLevel>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <LogLevel>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = LogLevel.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
}
/// Transformation class that can [encode] an instance of [LogLevel] to String,
/// and [decode] dynamic data back to [LogLevel].
class LogLevelTypeTransformer {
factory LogLevelTypeTransformer() => _instance ??= const LogLevelTypeTransformer._();
const LogLevelTypeTransformer._();
String encode(LogLevel data) => data.value;
/// Decodes a [dynamic value][data] to a LogLevel.
///
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code.
LogLevel? decode(dynamic data, {bool allowNull = true}) {
if (data != null) {
switch (data) {
case r'verbose': return LogLevel.verbose;
case r'debug': return LogLevel.debug;
case r'log': return LogLevel.log;
case r'warn': return LogLevel.warn;
case r'error': return LogLevel.error;
case r'fatal': return LogLevel.fatal;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
}
return null;
}
/// Singleton [LogLevelTypeTransformer] instance.
static LogLevelTypeTransformer? _instance;
}
+9 -1
View File
@@ -16,6 +16,7 @@ class SystemConfigDto {
required this.ffmpeg,
required this.job,
required this.library_,
required this.logging,
required this.machineLearning,
required this.map,
required this.newVersionCheck,
@@ -34,6 +35,8 @@ class SystemConfigDto {
SystemConfigLibraryDto library_;
SystemConfigLoggingDto logging;
SystemConfigMachineLearningDto machineLearning;
SystemConfigMapDto map;
@@ -59,6 +62,7 @@ class SystemConfigDto {
other.ffmpeg == ffmpeg &&
other.job == job &&
other.library_ == library_ &&
other.logging == logging &&
other.machineLearning == machineLearning &&
other.map == map &&
other.newVersionCheck == newVersionCheck &&
@@ -76,6 +80,7 @@ class SystemConfigDto {
(ffmpeg.hashCode) +
(job.hashCode) +
(library_.hashCode) +
(logging.hashCode) +
(machineLearning.hashCode) +
(map.hashCode) +
(newVersionCheck.hashCode) +
@@ -88,13 +93,14 @@ class SystemConfigDto {
(trash.hashCode);
@override
String toString() => 'SystemConfigDto[ffmpeg=$ffmpeg, job=$job, library_=$library_, machineLearning=$machineLearning, map=$map, newVersionCheck=$newVersionCheck, oauth=$oauth, passwordLogin=$passwordLogin, reverseGeocoding=$reverseGeocoding, storageTemplate=$storageTemplate, theme=$theme, thumbnail=$thumbnail, trash=$trash]';
String toString() => 'SystemConfigDto[ffmpeg=$ffmpeg, job=$job, library_=$library_, logging=$logging, machineLearning=$machineLearning, map=$map, newVersionCheck=$newVersionCheck, oauth=$oauth, passwordLogin=$passwordLogin, reverseGeocoding=$reverseGeocoding, storageTemplate=$storageTemplate, theme=$theme, thumbnail=$thumbnail, trash=$trash]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'ffmpeg'] = this.ffmpeg;
json[r'job'] = this.job;
json[r'library'] = this.library_;
json[r'logging'] = this.logging;
json[r'machineLearning'] = this.machineLearning;
json[r'map'] = this.map;
json[r'newVersionCheck'] = this.newVersionCheck;
@@ -119,6 +125,7 @@ class SystemConfigDto {
ffmpeg: SystemConfigFFmpegDto.fromJson(json[r'ffmpeg'])!,
job: SystemConfigJobDto.fromJson(json[r'job'])!,
library_: SystemConfigLibraryDto.fromJson(json[r'library'])!,
logging: SystemConfigLoggingDto.fromJson(json[r'logging'])!,
machineLearning: SystemConfigMachineLearningDto.fromJson(json[r'machineLearning'])!,
map: SystemConfigMapDto.fromJson(json[r'map'])!,
newVersionCheck: SystemConfigNewVersionCheckDto.fromJson(json[r'newVersionCheck'])!,
@@ -179,6 +186,7 @@ class SystemConfigDto {
'ffmpeg',
'job',
'library',
'logging',
'machineLearning',
'map',
'newVersionCheck',
+106
View File
@@ -0,0 +1,106 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class SystemConfigLoggingDto {
/// Returns a new [SystemConfigLoggingDto] instance.
SystemConfigLoggingDto({
required this.enabled,
required this.level,
});
bool enabled;
LogLevel level;
@override
bool operator ==(Object other) => identical(this, other) || other is SystemConfigLoggingDto &&
other.enabled == enabled &&
other.level == level;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(enabled.hashCode) +
(level.hashCode);
@override
String toString() => 'SystemConfigLoggingDto[enabled=$enabled, level=$level]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'enabled'] = this.enabled;
json[r'level'] = this.level;
return json;
}
/// Returns a new [SystemConfigLoggingDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static SystemConfigLoggingDto? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return SystemConfigLoggingDto(
enabled: mapValueOfType<bool>(json, r'enabled')!,
level: LogLevel.fromJson(json[r'level'])!,
);
}
return null;
}
static List<SystemConfigLoggingDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <SystemConfigLoggingDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = SystemConfigLoggingDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, SystemConfigLoggingDto> mapFromJson(dynamic json) {
final map = <String, SystemConfigLoggingDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = SystemConfigLoggingDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of SystemConfigLoggingDto-objects as value to a dart map
static Map<String, List<SystemConfigLoggingDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<SystemConfigLoggingDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = SystemConfigLoggingDto.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'enabled',
'level',
};
}
+21
View File
@@ -0,0 +1,21 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for LogLevel
void main() {
group('test LogLevel', () {
});
}
+5
View File
@@ -31,6 +31,11 @@ void main() {
// TODO
});
// SystemConfigLoggingDto logging
test('to test the property `logging`', () async {
// TODO
});
// SystemConfigMachineLearningDto machineLearning
test('to test the property `machineLearning`', () async {
// TODO
+32
View File
@@ -0,0 +1,32 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for SystemConfigLoggingDto
void main() {
// final instance = SystemConfigLoggingDto();
group('test SystemConfigLoggingDto', () {
// bool enabled
test('to test the property `enabled`', () async {
// TODO
});
// LogLevel level
test('to test the property `level`', () async {
// TODO
});
});
}
+30
View File
@@ -7949,6 +7949,17 @@
],
"type": "string"
},
"LogLevel": {
"enum": [
"verbose",
"debug",
"log",
"warn",
"error",
"fatal"
],
"type": "string"
},
"LoginCredentialDto": {
"properties": {
"email": {
@@ -9039,6 +9050,9 @@
"library": {
"$ref": "#/components/schemas/SystemConfigLibraryDto"
},
"logging": {
"$ref": "#/components/schemas/SystemConfigLoggingDto"
},
"machineLearning": {
"$ref": "#/components/schemas/SystemConfigMachineLearningDto"
},
@@ -9072,6 +9086,7 @@
},
"required": [
"ffmpeg",
"logging",
"machineLearning",
"map",
"newVersionCheck",
@@ -9243,6 +9258,21 @@
],
"type": "object"
},
"SystemConfigLoggingDto": {
"properties": {
"enabled": {
"type": "boolean"
},
"level": {
"$ref": "#/components/schemas/LogLevel"
}
},
"required": [
"level",
"enabled"
],
"type": "object"
},
"SystemConfigMachineLearningDto": {
"properties": {
"classification": {
-3
View File
@@ -153,9 +153,6 @@
"statements": 90
}
},
"setupFilesAfterEnv": [
"<rootDir>/test/setup.ts"
],
"testEnvironment": "node",
"moduleNameMapper": {
"^@test(|/.*)$": "<rootDir>/test/$1",
+3 -2
View File
@@ -1,5 +1,6 @@
import { AssetEntity, LibraryType } from '@app/infra/entities';
import { BadRequestException, Inject, Logger } from '@nestjs/common';
import { ImmichLogger } from '@app/infra/logger';
import { BadRequestException, Inject } from '@nestjs/common';
import _ from 'lodash';
import { DateTime, Duration } from 'luxon';
import { extname } from 'path';
@@ -75,7 +76,7 @@ export interface UploadFile {
}
export class AssetService {
private logger = new Logger(AssetService.name);
private logger = new ImmichLogger(AssetService.name);
private access: AccessCore;
private configCore: SystemConfigCore;
+3 -2
View File
@@ -1,5 +1,6 @@
import { AssetPathType, DatabaseAction, PersonPathType, UserPathType } from '@app/infra/entities';
import { BadRequestException, Inject, Injectable, Logger } from '@nestjs/common';
import { ImmichLogger } from '@app/infra/logger';
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
import { DateTime } from 'luxon';
import { resolve } from 'node:path';
import { AccessCore, Permission } from '../access';
@@ -29,7 +30,7 @@ import {
@Injectable()
export class AuditService {
private access: AccessCore;
private logger = new Logger(AuditService.name);
private logger = new ImmichLogger(AuditService.name);
constructor(
@Inject(IAccessRepository) accessRepository: IAccessRepository,
+2 -2
View File
@@ -1,10 +1,10 @@
import { SystemConfig, UserEntity } from '@app/infra/entities';
import { ImmichLogger } from '@app/infra/logger';
import {
BadRequestException,
Inject,
Injectable,
InternalServerErrorException,
Logger,
UnauthorizedException,
} from '@nestjs/common';
import cookieParser from 'cookie';
@@ -68,7 +68,7 @@ interface OAuthProfile extends UserinfoResponse {
export class AuthService {
private access: AccessCore;
private configCore: SystemConfigCore;
private logger = new Logger(AuthService.name);
private logger = new ImmichLogger(AuthService.name);
private userCore: UserCore;
constructor(
+4 -12
View File
@@ -1,5 +1,5 @@
// TODO: remove nestjs references from domain
import { LogLevel } from '@nestjs/common';
import { LogLevel } from '@app/infra/entities';
import { ConfigModuleOptions } from '@nestjs/config';
import Joi from 'joi';
@@ -18,19 +18,11 @@ export const immichAppConfig: ConfigModuleOptions = {
DB_PASSWORD: WHEN_DB_URL_SET,
DB_DATABASE_NAME: WHEN_DB_URL_SET,
DB_URL: Joi.string().optional(),
LOG_LEVEL: Joi.string().optional().valid('simple', 'verbose', 'debug', 'log', 'warn', 'error').default('log'),
LOG_LEVEL: Joi.string()
.optional()
.valid(...Object.values(LogLevel)),
MACHINE_LEARNING_PORT: Joi.number().optional(),
MICROSERVICES_PORT: Joi.number().optional(),
SERVER_PORT: Joi.number().optional(),
}),
};
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);
}
+2
View File
@@ -1,3 +1,4 @@
import { ImmichLogger } from '@app/infra/logger';
import { DynamicModule, Global, Module, ModuleMetadata, Provider } from '@nestjs/common';
import { ActivityService } from './activity';
import { AlbumService } from './album';
@@ -43,6 +44,7 @@ const providers: Provider[] = [
SystemConfigService,
TagService,
UserService,
ImmichLogger,
{
provide: INITIAL_SYSTEM_CONFIG,
inject: [SystemConfigService],
+3 -2
View File
@@ -1,5 +1,6 @@
import { AssetType } from '@app/infra/entities';
import { BadRequestException, Inject, Injectable, Logger } from '@nestjs/common';
import { ImmichLogger } from '@app/infra/logger';
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
import { mapAsset } from '../asset';
import {
ClientEvent,
@@ -18,7 +19,7 @@ import { AllJobStatusResponseDto, JobCommandDto, JobStatusDto } from './job.dto'
@Injectable()
export class JobService {
private logger = new Logger(JobService.name);
private logger = new ImmichLogger(JobService.name);
private configCore: SystemConfigCore;
constructor(
+3 -2
View File
@@ -1,5 +1,5 @@
import { AssetType, LibraryType } from '@app/infra/entities';
import { BadRequestException, Inject, Injectable, Logger } from '@nestjs/common';
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
import { R_OK } from 'node:constants';
import { Stats } from 'node:fs';
import path from 'node:path';
@@ -10,6 +10,7 @@ import { mimeTypes } from '../domain.constant';
import { usePagination, validateCronExpression } from '../domain.util';
import { IBaseJob, IEntityJob, ILibraryFileJob, ILibraryRefreshJob, JOBS_ASSET_PAGINATION_SIZE, JobName } from '../job';
import { ImmichLogger } from '@app/infra/logger';
import {
IAccessRepository,
IAssetRepository,
@@ -33,7 +34,7 @@ import {
@Injectable()
export class LibraryService {
readonly logger = new Logger(LibraryService.name);
readonly logger = new ImmichLogger(LibraryService.name);
private access: AccessCore;
private configCore: SystemConfigCore;
+3 -2
View File
@@ -7,7 +7,8 @@ import {
TranscodePolicy,
VideoCodec,
} from '@app/infra/entities';
import { Inject, Injectable, Logger, UnsupportedMediaTypeException } from '@nestjs/common';
import { ImmichLogger } from '@app/infra/logger';
import { Inject, Injectable, UnsupportedMediaTypeException } from '@nestjs/common';
import { usePagination } from '../domain.util';
import { IBaseJob, IEntityJob, JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from '../job';
import {
@@ -39,7 +40,7 @@ import {
@Injectable()
export class MediaService {
private logger = new Logger(MediaService.name);
private logger = new ImmichLogger(MediaService.name);
private configCore: SystemConfigCore;
private storageCore: StorageCore;
@@ -1,5 +1,6 @@
import { AssetEntity, AssetType, ExifEntity } from '@app/infra/entities';
import { Inject, Injectable, Logger } from '@nestjs/common';
import { ImmichLogger } from '@app/infra/logger';
import { Inject, Injectable } from '@nestjs/common';
import { ExifDateTime, Tags } from 'exiftool-vendored';
import { firstDateTime } from 'exiftool-vendored/dist/FirstDateTime';
import { constants } from 'fs/promises';
@@ -91,7 +92,7 @@ const validate = <T>(value: T): NonNullable<T> | null => {
@Injectable()
export class MetadataService {
private logger = new Logger(MetadataService.name);
private logger = new ImmichLogger(MetadataService.name);
private storageCore: StorageCore;
private configCore: SystemConfigCore;
private subscription: Subscription | null = null;
+3 -2
View File
@@ -1,6 +1,7 @@
import { PersonEntity } from '@app/infra/entities';
import { PersonPathType } from '@app/infra/entities/move.entity';
import { BadRequestException, Inject, Injectable, Logger, NotFoundException } from '@nestjs/common';
import { ImmichLogger } from '@app/infra/logger';
import { BadRequestException, Inject, Injectable, NotFoundException } from '@nestjs/common';
import { AccessCore, Permission } from '../access';
import { AssetResponseDto, BulkIdErrorReason, BulkIdResponseDto, mapAsset } from '../asset';
import { AuthDto } from '../auth';
@@ -45,7 +46,7 @@ export class PersonService {
private access: AccessCore;
private configCore: SystemConfigCore;
private storageCore: StorageCore;
readonly logger = new Logger(PersonService.name);
readonly logger = new ImmichLogger(PersonService.name);
constructor(
@Inject(IAccessRepository) accessRepository: IAccessRepository,
+3 -2
View File
@@ -1,5 +1,6 @@
import { AssetEntity } from '@app/infra/entities';
import { Inject, Injectable, Logger } from '@nestjs/common';
import { ImmichLogger } from '@app/infra/logger';
import { Inject, Injectable } from '@nestjs/common';
import { AssetResponseDto, mapAsset } from '../asset';
import { AuthDto } from '../auth';
import { PersonResponseDto } from '../person';
@@ -18,7 +19,7 @@ import { SearchResponseDto } from './response-dto';
@Injectable()
export class SearchService {
private logger = new Logger(SearchService.name);
private logger = new ImmichLogger(SearchService.name);
private configCore: SystemConfigCore;
constructor(
@@ -1,4 +1,5 @@
import { Inject, Injectable, Logger } from '@nestjs/common';
import { ImmichLogger } from '@app/infra/logger';
import { Inject, Injectable } from '@nestjs/common';
import { DateTime } from 'luxon';
import { ServerVersion, isDev, mimeTypes, serverVersion } from '../domain.constant';
import { asHumanReadable } from '../domain.util';
@@ -25,7 +26,7 @@ import {
@Injectable()
export class ServerInfoService {
private logger = new Logger(ServerInfoService.name);
private logger = new ImmichLogger(ServerInfoService.name);
private configCore: SystemConfigCore;
private releaseVersion = serverVersion;
private releaseVersionCheckedAt: DateTime | null = null;
@@ -1,4 +1,5 @@
import { Inject, Injectable, Logger } from '@nestjs/common';
import { ImmichLogger } from '@app/infra/logger';
import { Inject, Injectable } from '@nestjs/common';
import { setTimeout } from 'timers/promises';
import { usePagination } from '../domain.util';
import { IBaseJob, IEntityJob, JOBS_ASSET_PAGINATION_SIZE, JobName, QueueName } from '../job';
@@ -15,7 +16,7 @@ import { SystemConfigCore } from '../system-config';
@Injectable()
export class SmartInfoService {
private configCore: SystemConfigCore;
private logger = new Logger(SmartInfoService.name);
private logger = new ImmichLogger(SmartInfoService.name);
constructor(
@Inject(IAssetRepository) private assetRepository: IAssetRepository,

Some files were not shown because too many files have changed in this diff Show More