forked from sim0n00ps/OF-DL
Adding ffmpeg debug reporting config
This commit is contained in:
parent
e6075be886
commit
7d2e652dc5
@ -61,6 +61,9 @@ namespace OF_DL.Entities
|
||||
public int ApiRateLimitWindowSeconds { get; set; } = 10;
|
||||
public int MaxLogBodyLength { get; set; } = 2000;
|
||||
public bool EnableJsonResponseBodyRawLogs { get; set; } = false;
|
||||
[ToggleableConfig]
|
||||
public bool EnableFfmpegReport { get; set; } = true;
|
||||
public string FfmpegReportPath { get; set; } = Path.Combine("logs", "diagnostics", "ffmpeg");
|
||||
|
||||
// Indicates if you want to download only on specific dates.
|
||||
[ToggleableConfig]
|
||||
|
||||
@ -57,6 +57,9 @@ namespace OF_DL.Entities
|
||||
|
||||
int MaxLogBodyLength { get; set; }
|
||||
bool EnableJsonResponseBodyRawLogs { get; set; }
|
||||
|
||||
bool EnableFfmpegReport { get; set; }
|
||||
string FfmpegReportPath { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -632,8 +632,11 @@ public class DownloadHelper : IDownloadHelper
|
||||
|
||||
// Configure ffmpeg log level and optional report file location
|
||||
bool ffmpegDebugLogging = Log.IsEnabled(Serilog.Events.LogEventLevel.Debug);
|
||||
bool enableReport = downloadConfig.EnableFfmpegReport;
|
||||
|
||||
string logLevelArgs = ffmpegDebugLogging || downloadConfig.LoggingLevel is LoggingLevel.Verbose or LoggingLevel.Debug
|
||||
bool includeReport = enableReport && (ffmpegDebugLogging || downloadConfig.LoggingLevel is LoggingLevel.Verbose or LoggingLevel.Debug);
|
||||
|
||||
string logLevelArgs = includeReport
|
||||
? "-loglevel debug -report"
|
||||
: downloadConfig.LoggingLevel switch
|
||||
{
|
||||
@ -644,10 +647,12 @@ public class DownloadHelper : IDownloadHelper
|
||||
_ => string.Empty
|
||||
};
|
||||
|
||||
if (logLevelArgs.Contains("-report", StringComparison.OrdinalIgnoreCase))
|
||||
if (includeReport)
|
||||
{
|
||||
// Direct ffmpeg report files into the same logs directory Serilog uses (relative to current working directory)
|
||||
string logDir = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, "logs"));
|
||||
string reportDir = string.IsNullOrWhiteSpace(downloadConfig.FfmpegReportPath)
|
||||
? Path.Combine("logs", "diagnostics", "ffmpeg")
|
||||
: downloadConfig.FfmpegReportPath;
|
||||
string logDir = Path.GetFullPath(reportDir);
|
||||
Directory.CreateDirectory(logDir);
|
||||
string ffReportPath = Path.Combine(logDir, "ffmpeg-%p-%t.log"); // ffmpeg will replace %p/%t
|
||||
Environment.SetEnvironmentVariable("FFREPORT", $"file={ffReportPath}:level=32");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user