Fix Windows mpv logging and add log export (#88)

This commit is contained in:
2026-05-26 00:31:38 -07:00
committed by GitHub
parent 43ebc7d371
commit 11c196821d
150 changed files with 2748 additions and 582 deletions
+27
View File
@@ -0,0 +1,27 @@
export type SharedLogLevel = 'debug' | 'info' | 'warn' | 'error';
function hasOption(args: readonly string[], option: string): boolean {
return args.some((arg) => arg === option || arg.startsWith(`${option}=`));
}
export function buildMpvMsgLevel(logLevel: SharedLogLevel): string {
return `all=warn,subminer=${logLevel}`;
}
export function buildMpvLoggingArgs(
logLevel: SharedLogLevel,
logPath: string,
existingArgs: readonly string[] = [],
): string[] {
if (!logPath.trim()) {
return [];
}
const args: string[] = [];
if (!hasOption(existingArgs, '--log-file')) {
args.push(`--log-file=${logPath}`);
}
if (!hasOption(existingArgs, '--msg-level')) {
args.push(`--msg-level=${buildMpvMsgLevel(logLevel)}`);
}
return args;
}