mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-06-09 15:13:32 -07:00
Fix Windows mpv logging and add log export (#88)
This commit is contained in:
@@ -100,6 +100,36 @@ export function applyCoreDomainConfig(context: ResolveContext): void {
|
||||
'Expected debug, info, warn, or error.',
|
||||
);
|
||||
}
|
||||
|
||||
const logRotation = src.logging.rotation;
|
||||
if (typeof logRotation === 'number' && Number.isInteger(logRotation) && logRotation > 0) {
|
||||
resolved.logging.rotation = logRotation;
|
||||
} else if (src.logging.rotation !== undefined) {
|
||||
warn(
|
||||
'logging.rotation',
|
||||
src.logging.rotation,
|
||||
resolved.logging.rotation,
|
||||
'Expected a positive whole number of days.',
|
||||
);
|
||||
}
|
||||
|
||||
if (isObject(src.logging.files)) {
|
||||
for (const key of ['app', 'launcher', 'mpv'] as const) {
|
||||
const enabled = asBoolean(src.logging.files[key]);
|
||||
if (enabled !== undefined) {
|
||||
resolved.logging.files[key] = enabled;
|
||||
} else if (src.logging.files[key] !== undefined) {
|
||||
warn(
|
||||
`logging.files.${key}`,
|
||||
src.logging.files[key],
|
||||
resolved.logging.files[key],
|
||||
'Expected boolean.',
|
||||
);
|
||||
}
|
||||
}
|
||||
} else if (src.logging.files !== undefined) {
|
||||
warn('logging.files', src.logging.files, resolved.logging.files, 'Expected object.');
|
||||
}
|
||||
}
|
||||
|
||||
applyControllerConfig(context);
|
||||
|
||||
@@ -81,18 +81,6 @@ export function applyIntegrationConfig(context: ResolveContext): void {
|
||||
if (isObject(src.anilist.characterDictionary)) {
|
||||
const characterDictionary = src.anilist.characterDictionary;
|
||||
|
||||
const dictionaryEnabled = asBoolean(characterDictionary.enabled);
|
||||
if (dictionaryEnabled !== undefined) {
|
||||
resolved.anilist.characterDictionary.enabled = dictionaryEnabled;
|
||||
} else if (characterDictionary.enabled !== undefined) {
|
||||
warn(
|
||||
'anilist.characterDictionary.enabled',
|
||||
characterDictionary.enabled,
|
||||
resolved.anilist.characterDictionary.enabled,
|
||||
'Expected boolean.',
|
||||
);
|
||||
}
|
||||
|
||||
const refreshTtlHours = asNumber(characterDictionary.refreshTtlHours);
|
||||
if (refreshTtlHours !== undefined) {
|
||||
const normalized = Math.min(24 * 365, Math.max(1, Math.floor(refreshTtlHours)));
|
||||
|
||||
@@ -97,7 +97,6 @@ test('anilist character dictionary fields are parsed, clamped, and enum-validate
|
||||
const { context, warnings } = createResolveContext({
|
||||
anilist: {
|
||||
characterDictionary: {
|
||||
enabled: true,
|
||||
refreshTtlHours: 0,
|
||||
maxLoaded: 99,
|
||||
evictionPolicy: 'purge' as never,
|
||||
@@ -113,7 +112,6 @@ test('anilist character dictionary fields are parsed, clamped, and enum-validate
|
||||
|
||||
applyIntegrationConfig(context);
|
||||
|
||||
assert.equal(context.resolved.anilist.characterDictionary.enabled, true);
|
||||
assert.equal(context.resolved.anilist.characterDictionary.refreshTtlHours, 1);
|
||||
assert.equal(context.resolved.anilist.characterDictionary.maxLoaded, 20);
|
||||
assert.equal(context.resolved.anilist.characterDictionary.evictionPolicy, 'delete');
|
||||
|
||||
Reference in New Issue
Block a user