mirror of
https://github.com/C9Glax/tranga.git
synced 2025-02-23 15:50:13 +01:00
More Logging
This commit is contained in:
parent
bbd716383a
commit
2fcab1f1b1
@ -49,6 +49,7 @@ public abstract class GlobalBase
|
|||||||
|
|
||||||
protected void AddNotificationConnector(NotificationConnector notificationConnector)
|
protected void AddNotificationConnector(NotificationConnector notificationConnector)
|
||||||
{
|
{
|
||||||
|
Log($"Adding {notificationConnector}");
|
||||||
notificationConnectors.RemoveWhere(nc => nc.GetType() == notificationConnector.GetType());
|
notificationConnectors.RemoveWhere(nc => nc.GetType() == notificationConnector.GetType());
|
||||||
notificationConnectors.Add(notificationConnector);
|
notificationConnectors.Add(notificationConnector);
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ public abstract class GlobalBase
|
|||||||
|
|
||||||
protected void DeleteNotificationConnector(NotificationConnector.NotificationManagerType notificationManagerType)
|
protected void DeleteNotificationConnector(NotificationConnector.NotificationManagerType notificationManagerType)
|
||||||
{
|
{
|
||||||
|
Log($"Removing {notificationManagerType}");
|
||||||
notificationConnectors.RemoveWhere(nc => nc.notificationManagerType == notificationManagerType);
|
notificationConnectors.RemoveWhere(nc => nc.notificationManagerType == notificationManagerType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +72,7 @@ public abstract class GlobalBase
|
|||||||
|
|
||||||
protected void AddLibraryConnector(LibraryConnector libraryConnector)
|
protected void AddLibraryConnector(LibraryConnector libraryConnector)
|
||||||
{
|
{
|
||||||
|
Log($"Adding {libraryConnector}");
|
||||||
libraryConnectors.RemoveWhere(lc => lc.GetType() == libraryConnector.GetType());
|
libraryConnectors.RemoveWhere(lc => lc.GetType() == libraryConnector.GetType());
|
||||||
libraryConnectors.Add(libraryConnector);
|
libraryConnectors.Add(libraryConnector);
|
||||||
|
|
||||||
@ -80,6 +83,7 @@ public abstract class GlobalBase
|
|||||||
|
|
||||||
protected void DeleteLibraryConnector(LibraryConnector.LibraryType libraryType)
|
protected void DeleteLibraryConnector(LibraryConnector.LibraryType libraryType)
|
||||||
{
|
{
|
||||||
|
Log($"Removing {libraryType}");
|
||||||
libraryConnectors.RemoveWhere(lc => lc.libraryType == libraryType);
|
libraryConnectors.RemoveWhere(lc => lc.libraryType == libraryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,22 +15,22 @@ public class JobBoss : GlobalBase
|
|||||||
|
|
||||||
public void AddJob(Job job)
|
public void AddJob(Job job)
|
||||||
{
|
{
|
||||||
|
Log($"Added {job}");
|
||||||
this.jobs.Add(job);
|
this.jobs.Add(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveJob(Job job)
|
public void RemoveJob(Job job)
|
||||||
{
|
{
|
||||||
|
Log($"Removing {job}");
|
||||||
job.Cancel();
|
job.Cancel();
|
||||||
this.jobs.Remove(job);
|
this.jobs.Remove(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveJobs(IEnumerable<Job> jobs)
|
public void RemoveJobs(IEnumerable<Job> jobsToRemove)
|
||||||
{
|
{
|
||||||
foreach (Job job in jobs)
|
Log($"Removing {jobsToRemove.Count()} jobs.");
|
||||||
{
|
foreach (Job job in jobsToRemove)
|
||||||
job.Cancel();
|
RemoveJob(job);
|
||||||
this.jobs.Remove(job);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Job> GetJobsLike(string? connectorName = null, string? internalId = null, string? chapterNumber = null)
|
public IEnumerable<Job> GetJobsLike(string? connectorName = null, string? internalId = null, string? chapterNumber = null)
|
||||||
|
@ -42,7 +42,7 @@ public class Kavita : LibraryConnector
|
|||||||
JsonObject? result = JsonSerializer.Deserialize<JsonObject>(response.Content.ReadAsStream());
|
JsonObject? result = JsonSerializer.Deserialize<JsonObject>(response.Content.ReadAsStream());
|
||||||
if (result is not null)
|
if (result is not null)
|
||||||
return result["token"]!.GetValue<string>();
|
return result["token"]!.GetValue<string>();
|
||||||
else return "";
|
else throw new Exception("Did not receive token.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdateLibrary()
|
public override void UpdateLibrary()
|
||||||
|
@ -60,6 +60,7 @@ internal class DownloadClient : GlobalBase
|
|||||||
if(referrer is not null)
|
if(referrer is not null)
|
||||||
requestMessage.Headers.Referrer = new Uri(referrer);
|
requestMessage.Headers.Referrer = new Uri(referrer);
|
||||||
_lastExecutedRateLimit[requestType] = DateTime.Now;
|
_lastExecutedRateLimit[requestType] = DateTime.Now;
|
||||||
|
Log($"Requesting {requestType} {url}");
|
||||||
response = Client.Send(requestMessage);
|
response = Client.Send(requestMessage);
|
||||||
}
|
}
|
||||||
catch (HttpRequestException e)
|
catch (HttpRequestException e)
|
||||||
|
@ -33,7 +33,7 @@ public class Gotify : NotificationConnector
|
|||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
StreamReader sr = new (response.Content.ReadAsStream());
|
StreamReader sr = new (response.Content.ReadAsStream());
|
||||||
logger?.WriteLine(this.GetType().ToString(), $"{response.StatusCode}: {sr.ReadToEnd()}");
|
Log($"{response.StatusCode}: {sr.ReadToEnd()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,9 +397,9 @@ public class Server : GlobalBase
|
|||||||
: Array.Empty<byte>());
|
: Array.Empty<byte>());
|
||||||
response.OutputStream.Close();
|
response.OutputStream.Close();
|
||||||
}
|
}
|
||||||
catch (HttpListenerException)
|
catch (HttpListenerException e)
|
||||||
{
|
{
|
||||||
|
Log(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user