feat(logging): Adds support for Serilog (#573)
Example:
```cs
public class SomeClass
{
private static ILogger _logger;
private static Logger => _logger ??= LogFactory.GetLogger(typeof(SomeClass));
...
}
```
This commit is contained in:
parent
5e1ec5416d
commit
3a619e0103
29 changed files with 347 additions and 176 deletions
|
|
@ -73,8 +73,8 @@ namespace Server
|
|||
catch (Exception e)
|
||||
{
|
||||
Utility.PushColor(ConsoleColor.Red);
|
||||
Persistence.WriteConsoleLine($"***** Bad deserialize of {name} *****");
|
||||
Persistence.WriteConsoleLine(e.ToString());
|
||||
Console.WriteLine($"***** Bad deserialize of {name} *****");
|
||||
Console.WriteLine(e.ToString());
|
||||
Utility.PopColor();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public static class Persistence
|
||||
public class Persistence
|
||||
{
|
||||
public const int DefaultPriority = 100;
|
||||
|
||||
|
|
@ -105,20 +104,6 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void WriteConsole(string message)
|
||||
{
|
||||
var now = Core.Now;
|
||||
Console.Write("[{0} {1}] Persistence: {2}", now.ToShortDateString(), now.ToLongTimeString(), message);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void WriteConsoleLine(string message)
|
||||
{
|
||||
var now = Core.Now;
|
||||
Console.WriteLine("[{0} {1}] Persistence: {2}", now.ToShortDateString(), now.ToLongTimeString(), message);
|
||||
}
|
||||
|
||||
public static void TraceException(Exception ex)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue