mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-27 22:56:45 -04:00
The great logger.Error cleanup!
This commit is contained in:
@@ -108,16 +108,16 @@ namespace NzbDrone.Common.Disk
|
||||
|
||||
switch (stringComparison)
|
||||
{
|
||||
case StringComparison.CurrentCulture:
|
||||
case StringComparison.InvariantCulture:
|
||||
case StringComparison.Ordinal:
|
||||
{
|
||||
return File.Exists(path) && path == path.GetActualCasing();
|
||||
}
|
||||
case StringComparison.CurrentCulture:
|
||||
case StringComparison.InvariantCulture:
|
||||
case StringComparison.Ordinal:
|
||||
{
|
||||
return File.Exists(path) && path == path.GetActualCasing();
|
||||
}
|
||||
default:
|
||||
{
|
||||
return File.Exists(path);
|
||||
}
|
||||
{
|
||||
return File.Exists(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace NzbDrone.Common.Disk
|
||||
try
|
||||
{
|
||||
var testPath = Path.Combine(path, "sonarr_write_test.txt");
|
||||
var testContent = string.Format("This file was created to verify if '{0}' is writable. It should've been automatically deleted. Feel free to delete it.", path);
|
||||
var testContent = $"This file was created to verify if '{path}' is writable. It should've been automatically deleted. Feel free to delete it.";
|
||||
File.WriteAllText(testPath, testContent);
|
||||
File.Delete(testPath);
|
||||
return true;
|
||||
|
||||
@@ -352,7 +352,7 @@ namespace NzbDrone.Common.Disk
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, string.Format("Failed to properly rollback the file move [{0}] to [{1}], incomplete file may be left in target path.", sourcePath, targetPath));
|
||||
_logger.Error(ex, "Failed to properly rollback the file move [{0}] to [{1}], incomplete file may be left in target path.", sourcePath, targetPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ namespace NzbDrone.Common.Disk
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, string.Format("Failed to properly rollback the file move [{0}] to [{1}], file may be left in target path.", sourcePath, targetPath));
|
||||
_logger.Error(ex, "Failed to properly rollback the file move [{0}] to [{1}], file may be left in target path.", sourcePath, targetPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ namespace NzbDrone.Common.Disk
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, string.Format("Failed to properly rollback the file copy [{0}] to [{1}], file may be left in target path.", sourcePath, targetPath));
|
||||
_logger.Error(ex, "Failed to properly rollback the file copy [{0}] to [{1}], file may be left in target path.", sourcePath, targetPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ namespace NzbDrone.Common.Disk
|
||||
|
||||
if (i == RetryCount)
|
||||
{
|
||||
_logger.Error("Failed to completely transfer [{0}] to [{1}], aborting.", sourcePath, targetPath, i + 1, RetryCount);
|
||||
_logger.Error("Failed to completely transfer [{0}] to [{1}], aborting.", sourcePath, targetPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace NzbDrone.Common.Http
|
||||
response.StatusCode == HttpStatusCode.MovedPermanently ||
|
||||
response.StatusCode == HttpStatusCode.Found))
|
||||
{
|
||||
_logger.Error("Server requested a redirect to [" + response.Headers["Location"] + "]. Update the request URL to avoid this redirect.");
|
||||
_logger.Error("Server requested a redirect to [{0}]. Update the request URL to avoid this redirect.", response.Headers["Location"]);
|
||||
}
|
||||
|
||||
if (!request.SuppressHttpError && response.HasHttpError)
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace NzbDrone.Common.Instrumentation
|
||||
var exception = e.Exception;
|
||||
|
||||
Console.WriteLine("Task Error: {0}", exception);
|
||||
Logger.Error(exception, "Task Error: " + exception.Message);
|
||||
Logger.Error(exception, "Task Error");
|
||||
}
|
||||
|
||||
private static void HandleAppDomainException(object sender, UnhandledExceptionEventArgs e)
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
InternalLogger.Error("Unable to send Sentry request: {0}", e.Message);
|
||||
InternalLogger.Error(e, "Unable to send Sentry request");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace NzbDrone.Common.Processes
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "Unable to write PID file: " + filename);
|
||||
_logger.Error(ex, "Unable to write PID file {0}", filename);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,9 +98,9 @@ namespace NzbDrone.Common.Processes
|
||||
var process = new Process
|
||||
{
|
||||
StartInfo = new ProcessStartInfo(url)
|
||||
{
|
||||
UseShellExecute = true
|
||||
}
|
||||
{
|
||||
UseShellExecute = true
|
||||
}
|
||||
};
|
||||
|
||||
process.Start();
|
||||
@@ -136,9 +136,9 @@ namespace NzbDrone.Common.Processes
|
||||
logger.Debug("Starting {0} {1}", path, args);
|
||||
|
||||
var process = new Process
|
||||
{
|
||||
StartInfo = startInfo
|
||||
};
|
||||
{
|
||||
StartInfo = startInfo
|
||||
};
|
||||
|
||||
process.OutputDataReceived += (sender, eventArgs) =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user