LoggerExtensions
This commit is contained in:
parent
6ee7fbc3f6
commit
80964f193f
@ -32,10 +32,6 @@ public class CompositeLogger : ILogger
|
|||||||
_loggers[i].Log(context, severity, message, format);
|
_loggers[i].Log(context, severity, message, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Log(string context, LogSeverity severity, object message)
|
|
||||||
=> Log(context, severity, message, Format);
|
|
||||||
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _loggers.Length; i++)
|
for (int i = 0; i < _loggers.Length; i++)
|
||||||
|
|||||||
@ -27,9 +27,6 @@ public class ConsoleLogger : ILogger
|
|||||||
lock (consolelocker)
|
lock (consolelocker)
|
||||||
ColoredConsole.Write(ColorFromSeverity(severity),msg);
|
ColoredConsole.Write(ColorFromSeverity(severity),msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Log(string context, LogSeverity severity, object message)
|
|
||||||
=> Log(context, severity, message, Format);
|
|
||||||
|
|
||||||
private static ConsoleColor ColorFromSeverity(LogSeverity severity)
|
private static ConsoleColor ColorFromSeverity(LogSeverity severity)
|
||||||
=> severity switch
|
=> severity switch
|
||||||
|
|||||||
@ -33,23 +33,19 @@ public class FileLogger : ILogger
|
|||||||
if(!this.CheckSeverity(severity))
|
if(!this.CheckSeverity(severity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var msg = format.CreateMessage(context, severity, format).ToBytes(StringConverter.UTF8);
|
var msg = format.CreateMessage(context, severity, message);
|
||||||
lock (LogfileStream)
|
lock (LogfileStream)
|
||||||
{
|
{
|
||||||
LogfileStream.Write(msg);
|
LogfileStream.Write(msg.ToBytes(StringConverter.UTF8));
|
||||||
LogfileStream.Flush();
|
LogfileStream.Flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Log(string context, LogSeverity severity, object message)
|
|
||||||
=> Log(context, severity, message, Format);
|
|
||||||
|
|
||||||
public virtual void Dispose()
|
public virtual void Dispose()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LogfileStream?.Flush();
|
LogfileStream?.Flush();
|
||||||
LogfileStream?.Close();
|
|
||||||
LogfileStream?.Dispose();
|
LogfileStream?.Dispose();
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException) { }
|
catch (ObjectDisposedException) { }
|
||||||
|
|||||||
@ -9,7 +9,6 @@ public interface ILogger : IDisposable
|
|||||||
bool WarnLogEnabled { get; set; }
|
bool WarnLogEnabled { get; set; }
|
||||||
bool ErrorLogenabled { get; set; }
|
bool ErrorLogenabled { get; set; }
|
||||||
|
|
||||||
void Log(string context, LogSeverity severity, object message);
|
|
||||||
void Log(string context, LogSeverity severity, object message, ILogFormat format);
|
void Log(string context, LogSeverity severity, object message, ILogFormat format);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -15,24 +15,24 @@ public static class TestAutoarr
|
|||||||
|
|
||||||
public static void Fill(Autoarr<KVPair> ar)
|
public static void Fill(Autoarr<KVPair> ar)
|
||||||
{
|
{
|
||||||
Info.Log("c", "----------[TestAutoarr/Fill]----------");
|
OldLogger.Log("c", "----------[TestAutoarr/Fill]----------");
|
||||||
for(uint i=0;i<ar.MaxLength;i++)
|
for(uint i=0;i<ar.MaxLength;i++)
|
||||||
ar.Add(new KVPair($"key_{i}",new Unitype(i)));
|
ar.Add(new KVPair($"key_{i}",new Unitype(i)));
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Print(Autoarr<KVPair> ar)
|
public static void Print(Autoarr<KVPair> ar)
|
||||||
{
|
{
|
||||||
Info.Log("c", "----------[TestAutoarr/Print]---------");
|
OldLogger.Log("c", "----------[TestAutoarr/Print]---------");
|
||||||
foreach (KVPair pair in ar)
|
foreach (KVPair pair in ar)
|
||||||
Info.Log("h", pair.ToString());
|
OldLogger.Log("h", pair.ToString());
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Free(Autoarr<KVPair> ar)
|
public static void Free(Autoarr<KVPair> ar)
|
||||||
{
|
{
|
||||||
Info.Log("c", "----------[TestAutoarr/Free]----------");
|
OldLogger.Log("c", "----------[TestAutoarr/Free]----------");
|
||||||
ar.Dispose();
|
ar.Dispose();
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -16,73 +16,73 @@ public static class TestDtsodV23
|
|||||||
|
|
||||||
public static void TestBaseTypes()
|
public static void TestBaseTypes()
|
||||||
{
|
{
|
||||||
Info.Log("c", "-----[TestDtsodV23/TestBaseTypes]-----");
|
OldLogger.Log("c", "-----[TestDtsodV23/TestBaseTypes]-----");
|
||||||
DtsodV23 dtsod = new(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}base_types.dtsod"));
|
DtsodV23 dtsod = new(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}base_types.dtsod"));
|
||||||
foreach (var pair in dtsod)
|
foreach (var pair in dtsod)
|
||||||
Info.Log("b", pair.Value.GetType().Name + ' ', "w", pair.Key + ' ', "c", pair.Value.ToString());
|
OldLogger.Log("b", pair.Value.GetType().Name + ' ', "w", pair.Key + ' ', "c", pair.Value.ToString());
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
public static void TestLists()
|
public static void TestLists()
|
||||||
{
|
{
|
||||||
Info.Log("c", "-------[TestDtsodV23/TestLists]-------");
|
OldLogger.Log("c", "-------[TestDtsodV23/TestLists]-------");
|
||||||
DtsodV23 dtsod = new(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}lists.dtsod"));
|
DtsodV23 dtsod = new(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}lists.dtsod"));
|
||||||
foreach (var pair in dtsod)
|
foreach (var pair in dtsod)
|
||||||
{
|
{
|
||||||
Info.Log("b", pair.Value.GetType().Name + ' ', "w", pair.Key, "c",
|
OldLogger.Log("b", pair.Value.GetType().Name + ' ', "w", pair.Key, "c",
|
||||||
$" count: {pair.Value.Count}");
|
$" count: {pair.Value.Count}");
|
||||||
foreach (var el in pair.Value)
|
foreach (var el in pair.Value)
|
||||||
Info.Log("b", '\t'+el.GetType().Name + ' ', "c", el.ToString());
|
OldLogger.Log("b", '\t'+el.GetType().Name + ' ', "c", el.ToString());
|
||||||
}
|
}
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestComplexes()
|
public static void TestComplexes()
|
||||||
{
|
{
|
||||||
Info.Log("c", "-----[TestDtsodV23/TestComplexes]-----");
|
OldLogger.Log("c", "-----[TestDtsodV23/TestComplexes]-----");
|
||||||
DtsodV23 dtsod = new(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}complexes.dtsod"));
|
DtsodV23 dtsod = new(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}complexes.dtsod"));
|
||||||
foreach (var complex in dtsod)
|
foreach (var complex in dtsod)
|
||||||
{
|
{
|
||||||
Info.Log("b", complex.Value.GetType().Name + ' ', "w", complex.Key,
|
OldLogger.Log("b", complex.Value.GetType().Name + ' ', "w", complex.Key,
|
||||||
"b", " size: ", "c", complex.Value.Keys.Count.ToString());
|
"b", " size: ", "c", complex.Value.Keys.Count.ToString());
|
||||||
foreach (var pair in (DtsodV23) complex.Value)
|
foreach (var pair in (DtsodV23) complex.Value)
|
||||||
Info.Log("b", '\t' + pair.Value.GetType().Name + ' ', "w", pair.Key + ' ',
|
OldLogger.Log("b", '\t' + pair.Value.GetType().Name + ' ', "w", pair.Key + ' ',
|
||||||
"c", pair.Value.ToString());
|
"c", pair.Value.ToString());
|
||||||
}
|
}
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestReSerialization()
|
public static void TestReSerialization()
|
||||||
{
|
{
|
||||||
Info.Log("c", "--[TestDtsodV23/TestReSerialization]--");
|
OldLogger.Log("c", "--[TestDtsodV23/TestReSerialization]--");
|
||||||
var dtsod = new DtsodV23(new DtsodV23(new DtsodV23(
|
var dtsod = new DtsodV23(new DtsodV23(new DtsodV23(
|
||||||
new DtsodV23(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}complexes.dtsod")).ToString()).ToString()).ToString());
|
new DtsodV23(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}complexes.dtsod")).ToString()).ToString()).ToString());
|
||||||
Info.Log("y", dtsod.ToString());
|
OldLogger.Log("y", dtsod.ToString());
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestSpeed()
|
public static void TestSpeed()
|
||||||
{
|
{
|
||||||
Info.Log("c", "-------[TestDtsodV23/TestSpeed]-------");
|
OldLogger.Log("c", "-------[TestDtsodV23/TestSpeed]-------");
|
||||||
IDtsod dtsod=null;
|
IDtsod dtsod=null;
|
||||||
string text = File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}messages.dtsod");
|
string text = File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}messages.dtsod");
|
||||||
LogOperationTime("V21 deserialization",64,()=>dtsod=new DtsodV21(text));
|
LogOperationTime("V21 deserialization",64,()=>dtsod=new DtsodV21(text));
|
||||||
LogOperationTime("V21 serialization", 64, () => _=dtsod.ToString());
|
LogOperationTime("V21 serialization", 64, () => _=dtsod.ToString());
|
||||||
LogOperationTime("V23 deserialization", 64, () => dtsod = new DtsodV23(text));
|
LogOperationTime("V23 deserialization", 64, () => dtsod = new DtsodV23(text));
|
||||||
LogOperationTime("V23 serialization", 64, () => _ = dtsod.ToString());
|
LogOperationTime("V23 serialization", 64, () => _ = dtsod.ToString());
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestMemoryConsumption()
|
public static void TestMemoryConsumption()
|
||||||
{
|
{
|
||||||
Info.Log("c", "----[TestDtsodV23/TestMemConsumpt]----");
|
OldLogger.Log("c", "----[TestDtsodV23/TestMemConsumpt]----");
|
||||||
string text = File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}messages.dtsod");
|
string text = File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}messages.dtsod");
|
||||||
var a = GC.GetTotalMemory(true);
|
var a = GC.GetTotalMemory(true);
|
||||||
var dtsods = new DtsodV23[64];
|
var dtsods = new DtsodV23[64];
|
||||||
for (int i = 0; i < dtsods.Length; i++)
|
for (int i = 0; i < dtsods.Length; i++)
|
||||||
dtsods[i] = new(text);
|
dtsods[i] = new(text);
|
||||||
var b = GC.GetTotalMemory(true);
|
var b = GC.GetTotalMemory(true);
|
||||||
Info.Log("b", "at the start: ","c",$"{a/1024} kb\n",
|
OldLogger.Log("b", "at the start: ","c",$"{a/1024} kb\n",
|
||||||
"b", "at the end: ", "c", $"{b / 1024} kb\n{dtsods.Count()}","b"," dtsods initialized");
|
"b", "at the end: ", "c", $"{b / 1024} kb\n{dtsods.Count()}","b"," dtsods initialized");
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,57 +17,57 @@ public static class TestDtsodV24
|
|||||||
|
|
||||||
public static void TestBaseTypes()
|
public static void TestBaseTypes()
|
||||||
{
|
{
|
||||||
Info.Log("c", "-----[TestDtsodV24/TestBaseTypes]-----");
|
OldLogger.Log("c", "-----[TestDtsodV24/TestBaseTypes]-----");
|
||||||
DtsodV24 dtsod = new(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV24{Путь.Разд}base_types.dtsod"));
|
DtsodV24 dtsod = new(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV24{Путь.Разд}base_types.dtsod"));
|
||||||
foreach (var pair in dtsod)
|
foreach (var pair in dtsod)
|
||||||
Info.Log("b", pair.ToString());
|
OldLogger.Log("b", pair.ToString());
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestComplexes()
|
public static void TestComplexes()
|
||||||
{
|
{
|
||||||
Info.Log("c", "-----[TestDtsodV24/TestComplexes]-----");
|
OldLogger.Log("c", "-----[TestDtsodV24/TestComplexes]-----");
|
||||||
DtsodV24 dtsod = new(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV24{Путь.Разд}complexes.dtsod"));
|
DtsodV24 dtsod = new(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV24{Путь.Разд}complexes.dtsod"));
|
||||||
Info.Log("h", dtsod.ToString());
|
OldLogger.Log("h", dtsod.ToString());
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestLists()
|
public static void TestLists()
|
||||||
{
|
{
|
||||||
Info.Log("c", "-------[TestDtsodV24/TestLists]-------");
|
OldLogger.Log("c", "-------[TestDtsodV24/TestLists]-------");
|
||||||
DtsodV24 dtsod = new(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV24{Путь.Разд}lists.dtsod"));
|
DtsodV24 dtsod = new(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV24{Путь.Разд}lists.dtsod"));
|
||||||
foreach (KVPair pair in dtsod)
|
foreach (KVPair pair in dtsod)
|
||||||
{
|
{
|
||||||
var list = new Autoarr<Unitype>(pair.value.VoidPtr, false);
|
var list = new Autoarr<Unitype>(pair.value.VoidPtr, false);
|
||||||
Info.Log("b", pair.key.HGlobalUTF8ToString(), "w", $" length: {list.Length}");
|
OldLogger.Log("b", pair.key.HGlobalUTF8ToString(), "w", $" length: {list.Length}");
|
||||||
foreach (var el in list)
|
foreach (var el in list)
|
||||||
{
|
{
|
||||||
Info.Log("h", '\t' + el.ToString());
|
OldLogger.Log("h", '\t' + el.ToString());
|
||||||
if (el.TypeCode == KerepTypeCode.AutoarrUnitypePtr)
|
if (el.TypeCode == KerepTypeCode.AutoarrUnitypePtr)
|
||||||
{
|
{
|
||||||
var ar = new Autoarr<Unitype>(el.VoidPtr, false);
|
var ar = new Autoarr<Unitype>(el.VoidPtr, false);
|
||||||
foreach (var k in ar)
|
foreach (var k in ar)
|
||||||
{
|
{
|
||||||
Info.Log($"\t\t{k.ToString()}");
|
OldLogger.Log($"\t\t{k.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestReSerialization()
|
public static void TestReSerialization()
|
||||||
{
|
{
|
||||||
Info.Log("c", "--[TestDtsodV24/TestReSerialization]--");
|
OldLogger.Log("c", "--[TestDtsodV24/TestReSerialization]--");
|
||||||
var dtsod = new DtsodV24(new DtsodV24(new DtsodV24(
|
var dtsod = new DtsodV24(new DtsodV24(new DtsodV24(
|
||||||
new DtsodV24(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV24{Путь.Разд}complexes.dtsod")).ToString()).ToString()).ToString());
|
new DtsodV24(File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV24{Путь.Разд}complexes.dtsod")).ToString()).ToString()).ToString());
|
||||||
Info.Log("h", dtsod.ToString());
|
OldLogger.Log("h", dtsod.ToString());
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestSpeed()
|
public static void TestSpeed()
|
||||||
{
|
{
|
||||||
Info.Log("c", "-------[TestDtsodV24/TestSpeed]-------");
|
OldLogger.Log("c", "-------[TestDtsodV24/TestSpeed]-------");
|
||||||
IDtsod dtsod=null;
|
IDtsod dtsod=null;
|
||||||
string _text = File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}messages.dtsod");
|
string _text = File.ReadAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV23{Путь.Разд}messages.dtsod");
|
||||||
string text = "";
|
string text = "";
|
||||||
@ -77,6 +77,6 @@ public static class TestDtsodV24
|
|||||||
File.WriteAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV24{Путь.Разд}messages.dtsod",text);
|
File.WriteAllText($"Dtsod{Путь.Разд}TestResources{Путь.Разд}DtsodV24{Путь.Разд}messages.dtsod",text);
|
||||||
LogOperationTime("V24 deserialization", 64, () => dtsod = new DtsodV24(text));
|
LogOperationTime("V24 deserialization", 64, () => dtsod = new DtsodV24(text));
|
||||||
LogOperationTime("V24 serialization", 64, () => text = dtsod.ToString());
|
LogOperationTime("V24 serialization", 64, () => text = dtsod.ToString());
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@ public static class TestPInvoke
|
|||||||
|
|
||||||
static public void TestUTF8()
|
static public void TestUTF8()
|
||||||
{
|
{
|
||||||
Info.Log("c", "--------[TestPInvoke/TestUTF8]--------", "b", "");
|
OldLogger.Log("c", "--------[TestPInvoke/TestUTF8]--------", "b", "");
|
||||||
IntPtr ptr;
|
IntPtr ptr;
|
||||||
string str="_$\"\\\\'''\ta ыыы000;2;=:%d;```";
|
string str="_$\"\\\\'''\ta ыыы000;2;=:%d;```";
|
||||||
for(int i=0; i<1000; i++)
|
for(int i=0; i<1000; i++)
|
||||||
@ -24,7 +24,7 @@ public static class TestPInvoke
|
|||||||
ptr = Unmanaged.StringToHGlobalUTF8(str);
|
ptr = Unmanaged.StringToHGlobalUTF8(str);
|
||||||
str = Unmanaged.HGlobalUTF8ToString(ptr);
|
str = Unmanaged.HGlobalUTF8ToString(ptr);
|
||||||
}
|
}
|
||||||
Info.Log("y", str);
|
OldLogger.Log("y", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("kerep", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("kerep", CallingConvention = CallingConvention.Cdecl)]
|
||||||
@ -32,9 +32,9 @@ public static class TestPInvoke
|
|||||||
|
|
||||||
public static void TestPrintf()
|
public static void TestPrintf()
|
||||||
{
|
{
|
||||||
Info.Log("c", "---------[TestPInvoke/Printf]---------", "b", "");
|
OldLogger.Log("c", "---------[TestPInvoke/Printf]---------", "b", "");
|
||||||
pinvoke_print("ъъ~ 中文");
|
pinvoke_print("ъъ~ 中文");
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("kerep", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("kerep", CallingConvention = CallingConvention.Cdecl)]
|
||||||
@ -42,11 +42,11 @@ public static class TestPInvoke
|
|||||||
|
|
||||||
public static unsafe void TestMarshalling()
|
public static unsafe void TestMarshalling()
|
||||||
{
|
{
|
||||||
Info.Log("c", "---------[TestAutoarr/TestMarshalling]----------");
|
OldLogger.Log("c", "---------[TestAutoarr/TestMarshalling]----------");
|
||||||
string msg = "ъъ~ 中文";
|
string msg = "ъъ~ 中文";
|
||||||
test_marshalling(msg, out var kptr);
|
test_marshalling(msg, out var kptr);
|
||||||
KVPair k = *(KVPair*)kptr;
|
KVPair k = *(KVPair*)kptr;
|
||||||
Info.Log("b", k.ToString());
|
OldLogger.Log("b", k.ToString());
|
||||||
Info.Log("g", "test completed");
|
OldLogger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10,17 +10,18 @@ global using DTLib.Filesystem;
|
|||||||
global using DTLib.Dtsod;
|
global using DTLib.Dtsod;
|
||||||
global using static DTLib.Tests.TesterLog;
|
global using static DTLib.Tests.TesterLog;
|
||||||
global using static DTLib.Tests.Program;
|
global using static DTLib.Tests.Program;
|
||||||
using DTLib.Logging;
|
using DTLib.Logging.New;
|
||||||
|
|
||||||
|
|
||||||
namespace DTLib.Tests;
|
namespace DTLib.Tests;
|
||||||
|
|
||||||
public static class Program
|
public static class Program
|
||||||
{
|
{
|
||||||
public static readonly ConsoleLogger Info = new("logs", "DTLib.Tests");
|
public static readonly Logging.ConsoleLogger OldLogger = new("logs", "DTLib.Tests");
|
||||||
|
public static readonly ILogger NewLogger = new CompositeLogger(new ConsoleLogger(), new FileLogger(OldLogger.LogfileName));
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
PublicLog.LogEvent += Info.Log;
|
Logging.PublicLog.LogEvent += OldLogger.Log;
|
||||||
Console.OutputEncoding = Encoding.UTF8;
|
Console.OutputEncoding = Encoding.UTF8;
|
||||||
Console.InputEncoding = Encoding.UTF8;
|
Console.InputEncoding = Encoding.UTF8;
|
||||||
Console.Title="tester";
|
Console.Title="tester";
|
||||||
@ -32,7 +33,7 @@ public static class Program
|
|||||||
TestDtsodV24.TestAll();
|
TestDtsodV24.TestAll();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{ Info.Log("r", ex.ToString()); }
|
{ NewLogger.LogException("Main", ex); }
|
||||||
Console.ResetColor();
|
Console.ResetColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user