Logging Enhancements (#1521)
* Recreated Kavita Logging with Serilog instead of Default. This needs to be move out of the appsettings now, to allow auto updater to patch. * Refactored the code to be completely configured via Code rather than appsettings.json. This is a required step for Auto Updating. * Added in the ability to send logs directly to the UI only for users on the log route. Stopping implementation as Alerts page will handle the rest of the implementation. * Fixed up the backup service to not rely on Config from appsettings.json * Tweaked the Logging levels available * Moved everything over to File-scoped namespaces * Moved everything over to File-scoped namespaces * Code cleanup, removed an old migration and changed so debug logging doesn't print sensitive db data * Removed dead code
This commit is contained in:
parent
9f715cc35f
commit
d1a14f7e68
212 changed files with 16599 additions and 16834 deletions
|
@ -1,66 +1,65 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace API.Comparators
|
||||
namespace API.Comparators;
|
||||
|
||||
/// <summary>
|
||||
/// Sorts chapters based on their Number. Uses natural ordering of doubles.
|
||||
/// </summary>
|
||||
public class ChapterSortComparer : IComparer<double>
|
||||
{
|
||||
/// <summary>
|
||||
/// Sorts chapters based on their Number. Uses natural ordering of doubles.
|
||||
/// Normal sort for 2 doubles. 0 always comes last
|
||||
/// </summary>
|
||||
public class ChapterSortComparer : IComparer<double>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
public int Compare(double x, double y)
|
||||
{
|
||||
/// <summary>
|
||||
/// Normal sort for 2 doubles. 0 always comes last
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
public int Compare(double x, double y)
|
||||
{
|
||||
if (x == 0.0 && y == 0.0) return 0;
|
||||
// if x is 0, it comes second
|
||||
if (x == 0.0) return 1;
|
||||
// if y is 0, it comes second
|
||||
if (y == 0.0) return -1;
|
||||
if (x == 0.0 && y == 0.0) return 0;
|
||||
// if x is 0, it comes second
|
||||
if (x == 0.0) return 1;
|
||||
// if y is 0, it comes second
|
||||
if (y == 0.0) return -1;
|
||||
|
||||
return x.CompareTo(y);
|
||||
}
|
||||
|
||||
public static readonly ChapterSortComparer Default = new ChapterSortComparer();
|
||||
return x.CompareTo(y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is a special case comparer used exclusively for sorting chapters within a single Volume for reading order.
|
||||
/// <example>
|
||||
/// Volume 10 has "Series - Vol 10" and "Series - Vol 10 Chapter 81". In this case, for reading order, the order is Vol 10, Vol 10 Chapter 81.
|
||||
/// This is represented by Chapter 0, Chapter 81.
|
||||
/// </example>
|
||||
/// </summary>
|
||||
public class ChapterSortComparerZeroFirst : IComparer<double>
|
||||
public static readonly ChapterSortComparer Default = new ChapterSortComparer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is a special case comparer used exclusively for sorting chapters within a single Volume for reading order.
|
||||
/// <example>
|
||||
/// Volume 10 has "Series - Vol 10" and "Series - Vol 10 Chapter 81". In this case, for reading order, the order is Vol 10, Vol 10 Chapter 81.
|
||||
/// This is represented by Chapter 0, Chapter 81.
|
||||
/// </example>
|
||||
/// </summary>
|
||||
public class ChapterSortComparerZeroFirst : IComparer<double>
|
||||
{
|
||||
public int Compare(double x, double y)
|
||||
{
|
||||
public int Compare(double x, double y)
|
||||
{
|
||||
if (x == 0.0 && y == 0.0) return 0;
|
||||
// if x is 0, it comes first
|
||||
if (x == 0.0) return -1;
|
||||
// if y is 0, it comes first
|
||||
if (y == 0.0) return 1;
|
||||
if (x == 0.0 && y == 0.0) return 0;
|
||||
// if x is 0, it comes first
|
||||
if (x == 0.0) return -1;
|
||||
// if y is 0, it comes first
|
||||
if (y == 0.0) return 1;
|
||||
|
||||
return x.CompareTo(y);
|
||||
}
|
||||
|
||||
public static readonly ChapterSortComparerZeroFirst Default = new ChapterSortComparerZeroFirst();
|
||||
return x.CompareTo(y);
|
||||
}
|
||||
|
||||
public class SortComparerZeroLast : IComparer<double>
|
||||
{
|
||||
public int Compare(double x, double y)
|
||||
{
|
||||
if (x == 0.0 && y == 0.0) return 0;
|
||||
// if x is 0, it comes last
|
||||
if (x == 0.0) return 1;
|
||||
// if y is 0, it comes last
|
||||
if (y == 0.0) return -1;
|
||||
public static readonly ChapterSortComparerZeroFirst Default = new ChapterSortComparerZeroFirst();
|
||||
}
|
||||
|
||||
return x.CompareTo(y);
|
||||
}
|
||||
public class SortComparerZeroLast : IComparer<double>
|
||||
{
|
||||
public int Compare(double x, double y)
|
||||
{
|
||||
if (x == 0.0 && y == 0.0) return 0;
|
||||
// if x is 0, it comes last
|
||||
if (x == 0.0) return 1;
|
||||
// if y is 0, it comes last
|
||||
if (y == 0.0) return -1;
|
||||
|
||||
return x.CompareTo(y);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue