mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-12 11:15:43 +02:00
Logging notification tweaks
This commit is contained in:
parent
46f90255bf
commit
fc0d7fc72f
@ -136,7 +136,7 @@ internal static EpisodeParseResult ParseTitle(string title)
|
|||||||
return parsedEpisode;
|
return parsedEpisode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Logger.Warn("Unable to parse text into episode info. {0}", title);
|
Logger.Warn("Unable to parse episode info. {0}", title);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public virtual EpisodeFile ImportFile(Series series, string filePath)
|
|||||||
{
|
{
|
||||||
ep.EpisodeFileId = fileId;
|
ep.EpisodeFileId = fileId;
|
||||||
_episodeProvider.UpdateEpisode(ep);
|
_episodeProvider.UpdateEpisode(ep);
|
||||||
Logger.Debug("Linking file {0} to {1}", filePath, ep);
|
Logger.Debug("Linking [{0}] > [{1}]", filePath, ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ public virtual bool MoveEpisodeFile(EpisodeFile episodeFile)
|
|||||||
_diskProvider.CreateDirectory(newFile.DirectoryName);
|
_diskProvider.CreateDirectory(newFile.DirectoryName);
|
||||||
|
|
||||||
//Do the rename
|
//Do the rename
|
||||||
Logger.Debug("Moving file [{0}] > [{1}]", episodeFile.Path, newFile.FullName);
|
Logger.Debug("Moving [{0}] > [{1}]", episodeFile.Path, newFile.FullName);
|
||||||
_diskProvider.MoveFile(episodeFile.Path, newFile.FullName);
|
_diskProvider.MoveFile(episodeFile.Path, newFile.FullName);
|
||||||
|
|
||||||
//Update the filename in the DB
|
//Update the filename in the DB
|
||||||
@ -176,7 +176,7 @@ public virtual void CleanUp(IList<EpisodeFile> files)
|
|||||||
{
|
{
|
||||||
if (!_diskProvider.FileExists(episodeFile.Path))
|
if (!_diskProvider.FileExists(episodeFile.Path))
|
||||||
{
|
{
|
||||||
Logger.Trace("File {0} no longer exists on disk. removing from database.", episodeFile.Path);
|
Logger.Trace("File [{0}] no longer exists on disk. removing from db", episodeFile.Path);
|
||||||
|
|
||||||
//Set the EpisodeFileId for each episode attached to this file to 0
|
//Set the EpisodeFileId for each episode attached to this file to 0
|
||||||
foreach (var episode in _episodeProvider.GetEpisodesByFileId(episodeFile.EpisodeFileId))
|
foreach (var episode in _episodeProvider.GetEpisodesByFileId(episodeFile.EpisodeFileId))
|
||||||
|
@ -44,7 +44,7 @@ private void DeleteSeries(ProgressNotification notification, int seriesId)
|
|||||||
|
|
||||||
_seriesProvider.DeleteSeries(seriesId);
|
_seriesProvider.DeleteSeries(seriesId);
|
||||||
|
|
||||||
notification.CurrentMessage = String.Format("Successfully deleted '{0}'", title);
|
notification.CurrentMessage = String.Format("Successfully deleted '{0}' from database", title);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -53,11 +53,11 @@ public virtual void Start(ProgressNotification notification, int targetId)
|
|||||||
{
|
{
|
||||||
notification.CurrentMessage = string.Format("Scanning disk for '{0}'", series.Title);
|
notification.CurrentMessage = string.Format("Scanning disk for '{0}'", series.Title);
|
||||||
_diskScanProvider.Scan(series);
|
_diskScanProvider.Scan(series);
|
||||||
notification.CurrentMessage = string.Format("Media File Scan completed for '{0}'", series.Title);
|
notification.CurrentMessage = string.Format("Disk Scan completed for '{0}'", series.Title);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("An error has occured while scanning " + series.Title, e);
|
Logger.ErrorException("An error has occurred while scanning " + series.Title, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,8 @@ private void ScanSeries(ProgressNotification notification)
|
|||||||
var updatedSeries = _seriesProvider.GetSeries(currentSeries.SeriesId);
|
var updatedSeries = _seriesProvider.GetSeries(currentSeries.SeriesId);
|
||||||
AutoIgnoreSeasons(updatedSeries.SeriesId);
|
AutoIgnoreSeasons(updatedSeries.SeriesId);
|
||||||
|
|
||||||
|
notification.CurrentMessage = String.Format("'{0}' was successfully imported", currentSeries.Title);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -73,7 +73,7 @@ public virtual bool RunScheduled()
|
|||||||
{
|
{
|
||||||
if (_isRunning)
|
if (_isRunning)
|
||||||
{
|
{
|
||||||
Logger.Info("Another instance of this job is already running. Ignoring request.");
|
Logger.Trace("Queue is already running. Ignoring scheduler's request.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_isRunning = true;
|
_isRunning = true;
|
||||||
@ -112,19 +112,19 @@ public virtual bool RunScheduled()
|
|||||||
/// <remarks>Job is only added to the queue if same job with the same targetId doesn't already exist in the queue.</remarks>
|
/// <remarks>Job is only added to the queue if same job with the same targetId doesn't already exist in the queue.</remarks>
|
||||||
public virtual bool QueueJob(Type jobType, int targetId = 0)
|
public virtual bool QueueJob(Type jobType, int targetId = 0)
|
||||||
{
|
{
|
||||||
Logger.Debug("Adding job ({0}:{1}) to the queue", jobType, targetId);
|
Logger.Debug("Adding [{0}:{1}] to the queue", jobType.Name, targetId);
|
||||||
lock (Queue)
|
lock (Queue)
|
||||||
{
|
{
|
||||||
var queueTuple = new Tuple<Type, int>(jobType, targetId);
|
var queueTuple = new Tuple<Type, int>(jobType, targetId);
|
||||||
|
|
||||||
if (Queue.Contains(queueTuple))
|
if (Queue.Contains(queueTuple))
|
||||||
{
|
{
|
||||||
Logger.Info("Job ({0}:{1}) already exists in queue. Skipping.", jobType, targetId);
|
Logger.Info("[{0}:{1}] already exists in job queue. Skipping.", jobType.Name, targetId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Queue.Add(queueTuple);
|
Queue.Add(queueTuple);
|
||||||
Logger.Trace("Job ({0}:{1}) added to the queue", jobType, targetId);
|
Logger.Trace("Job [{0}:{1}] added to the queue", jobType.Name, targetId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ public virtual bool QueueJob(Type jobType, int targetId = 0)
|
|||||||
{
|
{
|
||||||
if (_isRunning)
|
if (_isRunning)
|
||||||
{
|
{
|
||||||
Logger.Trace("Queue is already running. Ignoring request.");
|
Logger.Trace("Queue is already running. No need to start it up.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
_isRunning = true;
|
_isRunning = true;
|
||||||
@ -150,7 +150,7 @@ public virtual bool QueueJob(Type jobType, int targetId = 0)
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error has occured in queue processor thread", e);
|
Logger.ErrorException("Error has occurred in queue processor thread", e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -158,13 +158,13 @@ public virtual bool QueueJob(Type jobType, int targetId = 0)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_jobThread = new Thread(starter) { Name = "JobQueueThread", Priority = ThreadPriority.BelowNormal };
|
_jobThread = new Thread(starter) { Name = "JobQueueThread" };
|
||||||
_jobThread.Start();
|
_jobThread.Start();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.Warn("Execution lock has has fucked up. Thread still active. Ignoring request.");
|
Logger.Error("Execution lock has fucked up. Thread still active. Ignoring request.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ private void Execute(Type jobType, int targetId = 0)
|
|||||||
var jobImplementation = _jobs.Where(t => t.GetType() == jobType).FirstOrDefault();
|
var jobImplementation = _jobs.Where(t => t.GetType() == jobType).FirstOrDefault();
|
||||||
if (jobImplementation == null)
|
if (jobImplementation == null)
|
||||||
{
|
{
|
||||||
Logger.Error("Unable to locate implementation for '{0}'. Make sure its properly registered.", jobType.ToString());
|
Logger.Error("Unable to locate implementation for '{0}'. Make sure it is properly registered.", jobType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ private void Execute(Type jobType, int targetId = 0)
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Logger.Debug("Starting job '{0}'. Last execution {1}", settings.Name, settings.LastExecution);
|
Logger.Debug("Starting '{0}' job. Last execution {1}", settings.Name, settings.LastExecution);
|
||||||
|
|
||||||
var sw = Stopwatch.StartNew();
|
var sw = Stopwatch.StartNew();
|
||||||
|
|
||||||
@ -252,12 +252,12 @@ private void Execute(Type jobType, int targetId = 0)
|
|||||||
settings.Success = true;
|
settings.Success = true;
|
||||||
|
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
Logger.Debug("Job '{0}' successfully completed in {1}.{2} seconds.", jobImplementation.Name, sw.Elapsed.Seconds,sw.Elapsed.Milliseconds/100,
|
Logger.Debug("Job '{0}' successfully completed in {1}.{2} seconds.", jobImplementation.Name, sw.Elapsed.Seconds, sw.Elapsed.Milliseconds / 100,
|
||||||
sw.Elapsed.Seconds);
|
sw.Elapsed.Seconds);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("An error has occurred while executing timer job " + jobImplementation.Name, e);
|
Logger.ErrorException("An error has occurred while executing job " + jobImplementation.Name, e);
|
||||||
_notification.Status = ProgressNotificationStatus.Failed;
|
_notification.Status = ProgressNotificationStatus.Failed;
|
||||||
_notification.CurrentMessage = jobImplementation.Name + " Failed.";
|
_notification.CurrentMessage = jobImplementation.Name + " Failed.";
|
||||||
|
|
||||||
|
@ -41,18 +41,17 @@ public int DefaultInterval
|
|||||||
|
|
||||||
public virtual void Start(ProgressNotification notification, int targetId)
|
public virtual void Start(ProgressNotification notification, int targetId)
|
||||||
{
|
{
|
||||||
Logger.Debug("Starting New Download Scan Job");
|
|
||||||
var dropFolder = _configProvider.SabDropDirectory;
|
var dropFolder = _configProvider.SabDropDirectory;
|
||||||
|
|
||||||
if (String.IsNullOrWhiteSpace(dropFolder))
|
if (String.IsNullOrWhiteSpace(dropFolder))
|
||||||
{
|
{
|
||||||
Logger.Debug("Skipping drop folder scan. No drop folder is defined.");
|
Logger.Debug("No drop folder is defined. Skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_diskProvider.FolderExists(dropFolder))
|
if (!_diskProvider.FolderExists(dropFolder))
|
||||||
{
|
{
|
||||||
Logger.Warn("Unable to Scan for New Downloads - folder Doesn't exist: {0}", dropFolder);
|
Logger.Warn("Unable to Scan for New Downloads - folder Doesn't exist: [{0}]", dropFolder);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,13 +63,13 @@ public virtual void Start(ProgressNotification notification, int targetId)
|
|||||||
|
|
||||||
if (subfolderInfo.Name.StartsWith("_UNPACK_", StringComparison.CurrentCultureIgnoreCase))
|
if (subfolderInfo.Name.StartsWith("_UNPACK_", StringComparison.CurrentCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
Logger.Info("Folder [{0}] is still being unpacked. skipping.", subfolder);
|
Logger.Debug("Folder [{0}] is still being unpacked. skipping.", subfolder);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subfolderInfo.Name.StartsWith("_FAILED_", StringComparison.CurrentCultureIgnoreCase))
|
if (subfolderInfo.Name.StartsWith("_FAILED_", StringComparison.CurrentCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
Logger.Info("Folder [{0}] is marked as failed. skipping.", subfolder);
|
Logger.Debug("Folder [{0}] is marked as failed. skipping.", subfolder);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +79,7 @@ public virtual void Start(ProgressNotification notification, int targetId)
|
|||||||
|
|
||||||
if (series == null)
|
if (series == null)
|
||||||
{
|
{
|
||||||
Logger.Warn("Unable to Import new download, series is not being watched");
|
Logger.Warn("Unable to Import new download, series doesn't exist in database.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,8 +95,6 @@ public virtual void Start(ProgressNotification notification, int targetId)
|
|||||||
Logger.ErrorException("An error has occurred while importing " + subfolder, e);
|
Logger.ErrorException("An error has occurred while importing " + subfolder, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Debug("New Download Scan Job completed successfully");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,10 +69,12 @@ public void Start(ProgressNotification notification, int targetId)
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("An error has occured while processing parse result items from " + episodeParseResult, e);
|
Logger.ErrorException("An error has occurred while processing parse result items from " + episodeParseResult, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notification.CurrentMessage = "RSS Sync Completed";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user