mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-28 06:22:45 -08:00
refactor(cli): remove deprecated verbose logging flags
This commit is contained in:
@@ -33,7 +33,7 @@ function makeArgs(overrides: Partial<CliArgs> = {}): CliArgs {
|
||||
autoStartOverlay: false,
|
||||
generateConfig: false,
|
||||
backupOverwrite: false,
|
||||
verbose: false,
|
||||
debug: false,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ export class MpvIpcClient implements MpvClient {
|
||||
this.transport = new MpvSocketTransport({
|
||||
socketPath,
|
||||
onConnect: () => {
|
||||
logger.info("Connected to MPV socket");
|
||||
logger.debug("Connected to MPV socket");
|
||||
this.connected = true;
|
||||
this.connecting = false;
|
||||
this.socket = this.transport.getSocket();
|
||||
@@ -192,7 +192,7 @@ export class MpvIpcClient implements MpvClient {
|
||||
this.deps.autoStartOverlay ||
|
||||
this.deps.getResolvedConfig().auto_start_overlay === true;
|
||||
if (this.firstConnection && shouldAutoStart) {
|
||||
logger.info("Auto-starting overlay, hiding mpv subtitles");
|
||||
logger.debug("Auto-starting overlay, hiding mpv subtitles");
|
||||
setTimeout(() => {
|
||||
this.deps.setOverlayVisible(true);
|
||||
}, 100);
|
||||
|
||||
@@ -35,7 +35,7 @@ function makeArgs(overrides: Partial<CliArgs> = {}): CliArgs {
|
||||
autoStartOverlay: false,
|
||||
generateConfig: false,
|
||||
backupOverwrite: false,
|
||||
verbose: false,
|
||||
debug: false,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
@@ -43,7 +43,7 @@ function makeArgs(overrides: Partial<CliArgs> = {}): CliArgs {
|
||||
test("runStartupBootstrapRuntimeService configures startup state and starts lifecycle", () => {
|
||||
const calls: string[] = [];
|
||||
const args = makeArgs({
|
||||
verbose: true,
|
||||
logLevel: "debug",
|
||||
socketPath: "/tmp/custom.sock",
|
||||
texthookerPort: 9001,
|
||||
backend: "x11",
|
||||
@@ -52,7 +52,7 @@ test("runStartupBootstrapRuntimeService configures startup state and starts life
|
||||
});
|
||||
|
||||
const result = runStartupBootstrapRuntimeService({
|
||||
argv: ["node", "main.ts", "--verbose"],
|
||||
argv: ["node", "main.ts", "--log-level", "debug"],
|
||||
parseArgs: () => args,
|
||||
setLogLevel: (level, source) => calls.push(`setLog:${level}:${source}`),
|
||||
forceX11Backend: () => calls.push("forceX11"),
|
||||
@@ -77,15 +77,14 @@ test("runStartupBootstrapRuntimeService configures startup state and starts life
|
||||
]);
|
||||
});
|
||||
|
||||
test("runStartupBootstrapRuntimeService prefers --log-level over --verbose", () => {
|
||||
test("runStartupBootstrapRuntimeService keeps log-level precedence for repeated calls", () => {
|
||||
const calls: string[] = [];
|
||||
const args = makeArgs({
|
||||
logLevel: "warn",
|
||||
verbose: true,
|
||||
});
|
||||
|
||||
runStartupBootstrapRuntimeService({
|
||||
argv: ["node", "main.ts", "--log-level", "warn", "--verbose"],
|
||||
argv: ["node", "main.ts", "--log-level", "warn"],
|
||||
parseArgs: () => args,
|
||||
setLogLevel: (level, source) => calls.push(`setLog:${level}:${source}`),
|
||||
forceX11Backend: () => calls.push("forceX11"),
|
||||
@@ -103,6 +102,27 @@ test("runStartupBootstrapRuntimeService prefers --log-level over --verbose", ()
|
||||
]);
|
||||
});
|
||||
|
||||
test("runStartupBootstrapRuntimeService keeps --debug separate from log verbosity", () => {
|
||||
const calls: string[] = [];
|
||||
const args = makeArgs({
|
||||
debug: true,
|
||||
});
|
||||
|
||||
runStartupBootstrapRuntimeService({
|
||||
argv: ["node", "main.ts", "--debug"],
|
||||
parseArgs: () => args,
|
||||
setLogLevel: (level, source) => calls.push(`setLog:${level}:${source}`),
|
||||
forceX11Backend: () => calls.push("forceX11"),
|
||||
enforceUnsupportedWaylandMode: () => calls.push("enforceWayland"),
|
||||
getDefaultSocketPath: () => "/tmp/default.sock",
|
||||
defaultTexthookerPort: 5174,
|
||||
runGenerateConfigFlow: () => false,
|
||||
startAppLifecycle: () => calls.push("startLifecycle"),
|
||||
});
|
||||
|
||||
assert.deepEqual(calls, ["forceX11", "enforceWayland", "startLifecycle"]);
|
||||
});
|
||||
|
||||
test("runStartupBootstrapRuntimeService skips lifecycle when generate-config flow handled", () => {
|
||||
const calls: string[] = [];
|
||||
const args = makeArgs({ generateConfig: true, logLevel: "warn" });
|
||||
|
||||
@@ -47,8 +47,6 @@ export function runStartupBootstrapRuntimeService(
|
||||
|
||||
if (initialArgs.logLevel) {
|
||||
deps.setLogLevel(initialArgs.logLevel, "cli");
|
||||
} else if (initialArgs.verbose) {
|
||||
deps.setLogLevel("debug", "cli");
|
||||
}
|
||||
|
||||
deps.forceX11Backend(initialArgs);
|
||||
|
||||
@@ -791,7 +791,7 @@ async function enrichYomitanPos1(
|
||||
mecabTokens = await deps.tokenizeWithMecab(text);
|
||||
} catch (err) {
|
||||
const error = err as Error;
|
||||
console.warn(
|
||||
logger.warn(
|
||||
"Failed to enrich Yomitan tokens with MeCab POS:",
|
||||
error.message,
|
||||
`tokenCount=${tokens.length}`,
|
||||
@@ -801,7 +801,7 @@ async function enrichYomitanPos1(
|
||||
}
|
||||
|
||||
if (!mecabTokens || mecabTokens.length === 0) {
|
||||
console.warn(
|
||||
logger.warn(
|
||||
"MeCab enrichment returned no tokens; preserving Yomitan token output.",
|
||||
`tokenCount=${tokens.length}`,
|
||||
`textLength=${text.length}`,
|
||||
@@ -886,7 +886,7 @@ async function ensureYomitanParserWindow(
|
||||
}
|
||||
return true;
|
||||
} catch (err) {
|
||||
console.error(
|
||||
logger.error(
|
||||
"Failed to initialize Yomitan parser window:",
|
||||
(err as Error).message,
|
||||
);
|
||||
@@ -977,8 +977,8 @@ async function parseWithYomitanInternalParser(
|
||||
}
|
||||
|
||||
return enrichYomitanPos1(yomitanTokens, deps, text);
|
||||
} catch (err) {
|
||||
console.error("Yomitan parser request failed:", (err as Error).message);
|
||||
} catch (err) {
|
||||
logger.error("Yomitan parser request failed:", (err as Error).message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1066,7 +1066,7 @@ export async function tokenizeSubtitleService(
|
||||
};
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Tokenization error:", (err as Error).message);
|
||||
logger.error("Tokenization error:", (err as Error).message);
|
||||
}
|
||||
|
||||
return { text: displayText, tokens: null };
|
||||
|
||||
Reference in New Issue
Block a user