diff --git a/src/N_m3u8DL-RE.Common/Log/Logger.cs b/src/N_m3u8DL-RE.Common/Log/Logger.cs
index b5df0f2..ee006f4 100644
--- a/src/N_m3u8DL-RE.Common/Log/Logger.cs
+++ b/src/N_m3u8DL-RE.Common/Log/Logger.cs
@@ -35,6 +35,8 @@ namespace N_m3u8DL_RE.Common.Log
public static void InitLogFile()
{
+ if (!IsWriteFile) return;
+
try
{
var logDir = Path.GetDirectoryName(Environment.ProcessPath) + "/Logs";
@@ -195,5 +197,33 @@ namespace N_m3u8DL_RE.Common.Log
}
ErrorMarkUp(data);
}
+
+ ///
+ /// This thing will only write to the log file.
+ ///
+ ///
+ ///
+ public static void Extra(string data, params object[] ps)
+ {
+ if (IsWriteFile && File.Exists(LogFilePath))
+ {
+ data = ReplaceVars(data, ps);
+ var plain = GetCurrTime() + " " + "EXTRA: " + data.RemoveMarkup();
+ try
+ {
+ //进入写入
+ LogWriteLock.EnterWriteLock();
+ using (StreamWriter sw = File.AppendText(LogFilePath))
+ {
+ sw.WriteLine(plain, Encoding.UTF8);
+ }
+ }
+ finally
+ {
+ //释放占用
+ LogWriteLock.ExitWriteLock();
+ }
+ }
+ }
}
}
diff --git a/src/N_m3u8DL-RE.Common/Util/HTTPUtil.cs b/src/N_m3u8DL-RE.Common/Util/HTTPUtil.cs
index b26d452..b0f0def 100644
--- a/src/N_m3u8DL-RE.Common/Util/HTTPUtil.cs
+++ b/src/N_m3u8DL-RE.Common/Util/HTTPUtil.cs
@@ -59,6 +59,7 @@ namespace N_m3u8DL_RE.Common.Util
if (redirectedUrl != url)
{
+ Logger.Extra($"Redirected => {redirectedUrl}");
return await DoGetAsync(redirectedUrl, headers);
}
}
diff --git a/src/N_m3u8DL-RE/Directory.Build.props b/src/N_m3u8DL-RE/Directory.Build.props
index c1dc76c..4819928 100644
--- a/src/N_m3u8DL-RE/Directory.Build.props
+++ b/src/N_m3u8DL-RE/Directory.Build.props
@@ -15,7 +15,7 @@
-
+
diff --git a/src/N_m3u8DL-RE/Downloader/SimpleDownloader.cs b/src/N_m3u8DL-RE/Downloader/SimpleDownloader.cs
index 1fe73a2..3076aa8 100644
--- a/src/N_m3u8DL-RE/Downloader/SimpleDownloader.cs
+++ b/src/N_m3u8DL-RE/Downloader/SimpleDownloader.cs
@@ -130,6 +130,7 @@ namespace N_m3u8DL_RE.Downloader
{
Logger.DebugMarkUp($"[grey]{ex.Message.EscapeMarkup()} retryCount: {retryCount}[/]");
Logger.Debug(url + " " + ex.ToString());
+ Logger.Extra($"Ah oh!{Environment.NewLine}RetryCount => {retryCount}{Environment.NewLine}Exception => {ex.Message}{Environment.NewLine}Url => {url}");
if (retryCount-- > 0)
{
await Task.Delay(1000);
@@ -137,6 +138,7 @@ namespace N_m3u8DL_RE.Downloader
}
else
{
+ Logger.Extra($"The retry attempts have been exhausted and the download of this segment has failed.{Environment.NewLine}Exception => {ex.Message}{Environment.NewLine}Url => {url}");
Logger.WarnMarkUp($"[grey]{ex.Message.EscapeMarkup()}[/]");
}
//throw new Exception("download failed", ex);
diff --git a/src/N_m3u8DL-RE/Program.cs b/src/N_m3u8DL-RE/Program.cs
index a21a4bc..0dd4e24 100644
--- a/src/N_m3u8DL-RE/Program.cs
+++ b/src/N_m3u8DL-RE/Program.cs
@@ -151,6 +151,7 @@ namespace N_m3u8DL_RE
foreach (var item in option.Headers)
{
headers[item.Key] = item.Value;
+ Logger.Extra($"User-Defined Header => {item.Key}: {item.Value}");
}
var parserConfig = new ParserConfig()