This commit is contained in:
shenlong-tanwen
2026-04-29 07:54:06 +07:00
parent 5933664862
commit 4c36716d57
9 changed files with 14 additions and 106 deletions
@@ -1,18 +0,0 @@
import 'package:immich_mobile/domain/models/log.model.dart';
class LogConfig {
final LogLevel level;
const LogConfig({this.level = .info});
LogConfig copyWith({LogLevel? level}) => .new(level: level ?? this.level);
@override
bool operator ==(Object other) => identical(this, other) || (other is LogConfig && other.level == level);
@override
int get hashCode => level.hashCode;
@override
String toString() => 'LogConfig(level: $level)';
}
@@ -1,18 +1,18 @@
import 'package:immich_mobile/domain/models/config/log_config.dart';
import 'package:immich_mobile/domain/models/log.model.dart';
class SystemConfig {
final LogConfig log;
final LogLevel logLevel;
const SystemConfig({this.log = const .new()});
const SystemConfig({this.logLevel = .info});
SystemConfig copyWith({LogConfig? log}) => .new(log: log ?? this.log);
SystemConfig copyWith({LogLevel? logLevel}) => SystemConfig(logLevel: logLevel ?? this.logLevel);
@override
bool operator ==(Object other) => identical(this, other) || (other is SystemConfig && other.log == log);
bool operator ==(Object other) => identical(this, other) || (other is SystemConfig && other.logLevel == logLevel);
@override
int get hashCode => log.hashCode;
int get hashCode => logLevel.hashCode;
@override
String toString() => 'SystemConfig(log: $log)';
String toString() => 'SystemConfig(logLevel: $logLevel)';
}
+1 -1
View File
@@ -56,7 +56,7 @@ class LogService {
}) async {
final instance = LogService._(logRepository, metadataRepository, shouldBuffer);
await logRepository.truncate(limit: kLogTruncateLimit);
final level = instance._metadataRepository.systemConfig.log.level;
final level = instance._metadataRepository.systemConfig.logLevel;
Logger.root.level = Level.LEVELS.elementAtOrNull(level.index) ?? Level.INFO;
return instance;
}