logging changes
This commit is contained in:
parent
ea9292f65f
commit
aed71aefe0
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--package info-->
|
<!--package info-->
|
||||||
<PackageId>DTLib.Dtsod</PackageId>
|
<PackageId>DTLib.Dtsod</PackageId>
|
||||||
<Version>1.2.1</Version>
|
<Version>1.3.0</Version>
|
||||||
<Authors>Timerix</Authors>
|
<Authors>Timerix</Authors>
|
||||||
<Description>Definitely not json</Description>
|
<Description>Definitely not json</Description>
|
||||||
<RepositoryType>GIT</RepositoryType>
|
<RepositoryType>GIT</RepositoryType>
|
||||||
@ -33,7 +33,7 @@
|
|||||||
<ProjectReference Include="..\DTLib\DTLib.csproj" />
|
<ProjectReference Include="..\DTLib\DTLib.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||||
<PackageReference Include="DTLib" Version="1.2.2" />
|
<PackageReference Include="DTLib" Version="1.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!--project files-->
|
<!--project files-->
|
||||||
|
|||||||
@ -4,7 +4,7 @@ global using System.Collections.Generic;
|
|||||||
global using System.Linq;
|
global using System.Linq;
|
||||||
global using System.Text;
|
global using System.Text;
|
||||||
global using DTLib.Extensions;
|
global using DTLib.Extensions;
|
||||||
global using static DTLib.Logging.PublicLog;
|
global using static DTLib.Logging.InternalLog;
|
||||||
|
|
||||||
namespace DTLib.Dtsod;
|
namespace DTLib.Dtsod;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--package info-->
|
<!--package info-->
|
||||||
<PackageId>DTLib.Logging</PackageId>
|
<PackageId>DTLib.Logging</PackageId>
|
||||||
<Version>1.2.1</Version>
|
<Version>1.3.0</Version>
|
||||||
<Authors>Timerix</Authors>
|
<Authors>Timerix</Authors>
|
||||||
<Description>Loggers with dependency injection</Description>
|
<Description>Loggers with dependency injection</Description>
|
||||||
<RepositoryType>GIT</RepositoryType>
|
<RepositoryType>GIT</RepositoryType>
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<ProjectReference Include="..\DTLib.Ben.Demystifier\DTLib.Ben.Demystifier.csproj" />
|
<ProjectReference Include="..\DTLib.Ben.Demystifier\DTLib.Ben.Demystifier.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||||
<PackageReference Include="DTLib" Version="1.2.2" />
|
<PackageReference Include="DTLib" Version="1.3.0" />
|
||||||
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.4" />
|
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -8,7 +8,7 @@ global using System.Threading.Tasks;
|
|||||||
global using DTLib.Extensions;
|
global using DTLib.Extensions;
|
||||||
global using DTLib.Filesystem;
|
global using DTLib.Filesystem;
|
||||||
|
|
||||||
namespace DTLib.Logging.New;
|
namespace DTLib.Logging;
|
||||||
|
|
||||||
/// this class can be used to setup logger for DTLib debug log messages
|
/// this class can be used to setup logger for DTLib debug log messages
|
||||||
public static class DTLibInternalLogging
|
public static class DTLibInternalLogging
|
||||||
@ -18,7 +18,7 @@ public static class DTLibInternalLogging
|
|||||||
public static void SetLogger(ILogger logger)
|
public static void SetLogger(ILogger logger)
|
||||||
{
|
{
|
||||||
_loggerContext = new ContextLogger("DTLib",logger);
|
_loggerContext = new ContextLogger("DTLib",logger);
|
||||||
PublicLog.LogEvent+=LogHandler;
|
InternalLog.LogEvent+=LogHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LogHandler(string[] msg)
|
private static void LogHandler(string[] msg)
|
||||||
|
|||||||
@ -5,7 +5,7 @@ namespace DTLib.Logging.DependencyInjection;
|
|||||||
public class LoggerService<TCaller> : ServiceDescriptor
|
public class LoggerService<TCaller> : ServiceDescriptor
|
||||||
{
|
{
|
||||||
// ReSharper disable once RedundantNameQualifier
|
// ReSharper disable once RedundantNameQualifier
|
||||||
public LoggerService(DTLib.Logging.New.ILogger logger) : base(
|
public LoggerService(DTLib.Logging.ILogger logger) : base(
|
||||||
typeof(Microsoft.Extensions.Logging.ILogger<TCaller>),
|
typeof(Microsoft.Extensions.Logging.ILogger<TCaller>),
|
||||||
new MyLoggerWrapper<TCaller>(logger))
|
new MyLoggerWrapper<TCaller>(logger))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using DTLib.Logging.New;
|
using DTLib.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
// ReSharper disable RedundantNameQualifier
|
// ReSharper disable RedundantNameQualifier
|
||||||
|
|
||||||
@ -6,8 +6,8 @@ namespace DTLib.Logging.DependencyInjection;
|
|||||||
|
|
||||||
public class MyLoggerWrapper<TCaller> : Microsoft.Extensions.Logging.ILogger<TCaller>
|
public class MyLoggerWrapper<TCaller> : Microsoft.Extensions.Logging.ILogger<TCaller>
|
||||||
{
|
{
|
||||||
public DTLib.Logging.New.ILogger Logger;
|
public DTLib.Logging.ILogger Logger;
|
||||||
public MyLoggerWrapper(DTLib.Logging.New.ILogger logger)=>
|
public MyLoggerWrapper(DTLib.Logging.ILogger logger)=>
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
|
|
||||||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace DTLib.Logging.New;
|
namespace DTLib.Logging;
|
||||||
|
|
||||||
public class DefaultLogFormat : ILogFormat
|
public class DefaultLogFormat : ILogFormat
|
||||||
{
|
{
|
||||||
@ -7,7 +7,7 @@ public class DefaultLogFormat : ILogFormat
|
|||||||
public bool PrintContext { get; set; }
|
public bool PrintContext { get; set; }
|
||||||
public bool PrintSeverity { get; set; }
|
public bool PrintSeverity { get; set; }
|
||||||
|
|
||||||
public DefaultLogFormat(bool printTimeStamp = false, bool printContext = true, bool printSeverity = true)
|
public DefaultLogFormat(bool printTimeStamp = true, bool printContext = true, bool printSeverity = true)
|
||||||
{
|
{
|
||||||
PrintTimeStamp = printTimeStamp;
|
PrintTimeStamp = printTimeStamp;
|
||||||
PrintContext = printContext;
|
PrintContext = printContext;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace DTLib.Logging.New;
|
namespace DTLib.Logging;
|
||||||
|
|
||||||
public interface ILogFormat
|
public interface ILogFormat
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace DTLib.Logging.New;
|
namespace DTLib.Logging;
|
||||||
|
|
||||||
public enum LogSeverity
|
public enum LogSeverity
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using DTLib.Ben.Demystifier;
|
using DTLib.Ben.Demystifier;
|
||||||
|
|
||||||
namespace DTLib.Logging.New;
|
namespace DTLib.Logging;
|
||||||
|
|
||||||
public static class LoggerExtensions
|
public static class LoggerExtensions
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace DTLib.Logging.New;
|
namespace DTLib.Logging;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This class can be used for unite many loggers into one
|
/// This class can be used for unite many loggers into one
|
||||||
@ -49,7 +49,7 @@ public class CompositeLogger : ILogger
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILogFormat Format { get; }
|
public ILogFormat Format { get; set; }
|
||||||
|
|
||||||
protected ILogger[] _loggers;
|
protected ILogger[] _loggers;
|
||||||
private bool _debugLogEnabled =
|
private bool _debugLogEnabled =
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using DTLib.Console;
|
using DTLib.Console;
|
||||||
|
|
||||||
namespace DTLib.Logging.New;
|
namespace DTLib.Logging;
|
||||||
|
|
||||||
// вывод лога в консоль и файл
|
// вывод лога в консоль и файл
|
||||||
public class ConsoleLogger : ILogger
|
public class ConsoleLogger : ILogger
|
||||||
@ -14,7 +14,7 @@ public class ConsoleLogger : ILogger
|
|||||||
public bool InfoLogEnabled { get; set; } = true;
|
public bool InfoLogEnabled { get; set; } = true;
|
||||||
public bool WarnLogEnabled { get; set; } = true;
|
public bool WarnLogEnabled { get; set; } = true;
|
||||||
public bool ErrorLogEnabled { get; set; } = true;
|
public bool ErrorLogEnabled { get; set; } = true;
|
||||||
public ILogFormat Format { get; }
|
public ILogFormat Format { get; set; }
|
||||||
|
|
||||||
readonly object consolelocker = new();
|
readonly object consolelocker = new();
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace DTLib.Logging.New;
|
namespace DTLib.Logging;
|
||||||
|
|
||||||
/// wrapper around ILogger and LoggerExtensions that stores context
|
/// wrapper around ILogger and LoggerExtensions that stores context
|
||||||
public class ContextLogger : ILogger
|
public class ContextLogger : ILogger
|
||||||
@ -50,7 +50,11 @@ public class ContextLogger : ILogger
|
|||||||
|
|
||||||
public void Dispose() => ParentLogger.Dispose();
|
public void Dispose() => ParentLogger.Dispose();
|
||||||
|
|
||||||
public ILogFormat Format => ParentLogger.Format;
|
public ILogFormat Format
|
||||||
|
{
|
||||||
|
get => ParentLogger.Format;
|
||||||
|
set => ParentLogger.Format=value;
|
||||||
|
}
|
||||||
|
|
||||||
public bool DebugLogEnabled
|
public bool DebugLogEnabled
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace DTLib.Logging.New;
|
namespace DTLib.Logging;
|
||||||
|
|
||||||
public class FileLogger : ILogger
|
public class FileLogger : ILogger
|
||||||
{
|
{
|
||||||
@ -11,7 +11,7 @@ public class FileLogger : ILogger
|
|||||||
public bool InfoLogEnabled { get; set; } = true;
|
public bool InfoLogEnabled { get; set; } = true;
|
||||||
public bool WarnLogEnabled { get; set; } = true;
|
public bool WarnLogEnabled { get; set; } = true;
|
||||||
public bool ErrorLogEnabled { get; set; } = true;
|
public bool ErrorLogEnabled { get; set; } = true;
|
||||||
public ILogFormat Format { get; }
|
public ILogFormat Format { get; set; }
|
||||||
|
|
||||||
public IOPath LogfileName { get; protected set; }
|
public IOPath LogfileName { get; protected set; }
|
||||||
public System.IO.FileStream LogfileStream { get; protected set; }
|
public System.IO.FileStream LogfileStream { get; protected set; }
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
namespace DTLib.Logging.New;
|
namespace DTLib.Logging;
|
||||||
|
|
||||||
public interface ILogger : IDisposable
|
public interface ILogger : IDisposable
|
||||||
{
|
{
|
||||||
|
|
||||||
ILogFormat Format { get; }
|
ILogFormat Format { get; set; }
|
||||||
bool DebugLogEnabled { get; set; }
|
bool DebugLogEnabled { get; set; }
|
||||||
bool InfoLogEnabled { get; set; }
|
bool InfoLogEnabled { get; set; }
|
||||||
bool WarnLogEnabled { get; set; }
|
bool WarnLogEnabled { get; set; }
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--package info-->
|
<!--package info-->
|
||||||
<PackageId>DTLib.Network</PackageId>
|
<PackageId>DTLib.Network</PackageId>
|
||||||
<Version>1.2.1</Version>
|
<Version>1.3.0</Version>
|
||||||
<Authors>Timerix</Authors>
|
<Authors>Timerix</Authors>
|
||||||
<Description>Some sick network protocols</Description>
|
<Description>Some sick network protocols</Description>
|
||||||
<RepositoryType>GIT</RepositoryType>
|
<RepositoryType>GIT</RepositoryType>
|
||||||
@ -32,6 +32,6 @@
|
|||||||
<ProjectReference Include="..\DTLib.Dtsod\DTLib.Dtsod.csproj" />
|
<ProjectReference Include="..\DTLib.Dtsod\DTLib.Dtsod.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||||
<PackageReference Include="DTLib.Dtsod" Version="1.1.5" />
|
<PackageReference Include="DTLib.Dtsod" Version="1.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -6,7 +6,7 @@ global using System.Linq;
|
|||||||
global using System.Text;
|
global using System.Text;
|
||||||
global using DTLib.Extensions;
|
global using DTLib.Extensions;
|
||||||
global using DTLib.Filesystem;
|
global using DTLib.Filesystem;
|
||||||
global using static DTLib.Logging.PublicLog;
|
global using static DTLib.Logging.InternalLog;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
|
||||||
|
|||||||
@ -27,10 +27,10 @@
|
|||||||
<ProjectReference Include="..\DTLib\DTLib.csproj" />
|
<ProjectReference Include="..\DTLib\DTLib.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||||
<PackageReference Include="DTLib" Version="1.2.2" />
|
<PackageReference Include="DTLib" Version="1.3.0" />
|
||||||
<PackageReference Include="DTLib.Dtsod" Version="1.1.5" />
|
<PackageReference Include="DTLib.Dtsod" Version="1.3.0" />
|
||||||
<PackageReference Include="DTLib.Network" Version="1.1.5" />
|
<PackageReference Include="DTLib.Network" Version="1.3.0" />
|
||||||
<PackageReference Include="DTLib.Logging" Version="1.1.5" />
|
<PackageReference Include="DTLib.Logging" Version="1.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!--project files-->
|
<!--project files-->
|
||||||
|
|||||||
@ -16,25 +16,25 @@ public static class TestAutoarr
|
|||||||
|
|
||||||
public static void Fill(Autoarr<KVPair> ar)
|
public static void Fill(Autoarr<KVPair> ar)
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "----------[TestAutoarr/Fill]----------");
|
Logger.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)));
|
||||||
OldLogger.Log("g", "test completed");
|
Logger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Print(Autoarr<KVPair> ar)
|
public static void Print(Autoarr<KVPair> ar)
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "----------[TestAutoarr/Print]---------");
|
Logger.Log("c", "----------[TestAutoarr/Print]---------");
|
||||||
foreach (KVPair pair in ar)
|
foreach (KVPair pair in ar)
|
||||||
OldLogger.Log("h", pair.ToString());
|
Logger.Log("h", pair.ToString());
|
||||||
OldLogger.Log("g", "test completed");
|
Logger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Free(Autoarr<KVPair> ar)
|
public static void Free(Autoarr<KVPair> ar)
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "----------[TestAutoarr/Free]----------");
|
Logger.Log("c", "----------[TestAutoarr/Free]----------");
|
||||||
ar.Dispose();
|
ar.Dispose();
|
||||||
OldLogger.Log("g", "test completed");
|
Logger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@ -16,73 +16,73 @@ public static class TestDtsodV23
|
|||||||
|
|
||||||
public static void TestBaseTypes()
|
public static void TestBaseTypes()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "-----[TestDtsodV23/TestBaseTypes]-----");
|
ColoredConsole.WriteLine("c", "-----[TestDtsodV23/TestBaseTypes]-----");
|
||||||
DtsodV23 dtsod = new(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}base_types.dtsod"));
|
DtsodV23 dtsod = new(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}base_types.dtsod"));
|
||||||
foreach (var pair in dtsod)
|
foreach (var pair in dtsod)
|
||||||
OldLogger.Log("b", pair.Value.GetType().Name + ' ', "w", pair.Key + ' ', "c", pair.Value.ToString());
|
ColoredConsole.WriteLine("b", pair.Value.GetType().Name + ' ', "w", pair.Key + ' ', "c", pair.Value.ToString());
|
||||||
OldLogger.Log("g", "test completed");
|
ColoredConsole.WriteLine("g", "test completed");
|
||||||
}
|
}
|
||||||
public static void TestLists()
|
public static void TestLists()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "-------[TestDtsodV23/TestLists]-------");
|
ColoredConsole.WriteLine("c", "-------[TestDtsodV23/TestLists]-------");
|
||||||
DtsodV23 dtsod = new(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}lists.dtsod"));
|
DtsodV23 dtsod = new(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}lists.dtsod"));
|
||||||
foreach (var pair in dtsod)
|
foreach (var pair in dtsod)
|
||||||
{
|
{
|
||||||
OldLogger.Log("b", pair.Value.GetType().Name + ' ', "w", pair.Key, "c",
|
ColoredConsole.WriteLine("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)
|
||||||
OldLogger.Log("b", '\t'+el.GetType().Name + ' ', "c", el.ToString());
|
ColoredConsole.WriteLine("b", '\t'+el.GetType().Name + ' ', "c", el.ToString());
|
||||||
}
|
}
|
||||||
OldLogger.Log("g", "test completed");
|
ColoredConsole.WriteLine("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestComplexes()
|
public static void TestComplexes()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "-----[TestDtsodV23/TestComplexes]-----");
|
ColoredConsole.WriteLine("c", "-----[TestDtsodV23/TestComplexes]-----");
|
||||||
DtsodV23 dtsod = new(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}complexes.dtsod"));
|
DtsodV23 dtsod = new(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}complexes.dtsod"));
|
||||||
foreach (var complex in dtsod)
|
foreach (var complex in dtsod)
|
||||||
{
|
{
|
||||||
OldLogger.Log("b", complex.Value.GetType().Name + ' ', "w", complex.Key,
|
ColoredConsole.WriteLine("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)
|
||||||
OldLogger.Log("b", '\t' + pair.Value.GetType().Name + ' ', "w", pair.Key + ' ',
|
ColoredConsole.WriteLine("b", '\t' + pair.Value.GetType().Name + ' ', "w", pair.Key + ' ',
|
||||||
"c", pair.Value.ToString());
|
"c", pair.Value.ToString());
|
||||||
}
|
}
|
||||||
OldLogger.Log("g", "test completed");
|
ColoredConsole.WriteLine("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestReSerialization()
|
public static void TestReSerialization()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "--[TestDtsodV23/TestReSerialization]--");
|
ColoredConsole.WriteLine("c", "--[TestDtsodV23/TestReSerialization]--");
|
||||||
var dtsod = new DtsodV23(new DtsodV23(new DtsodV23(
|
var dtsod = new DtsodV23(new DtsodV23(new DtsodV23(
|
||||||
new DtsodV23(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}complexes.dtsod")).ToString()).ToString()).ToString());
|
new DtsodV23(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}complexes.dtsod")).ToString()).ToString()).ToString());
|
||||||
OldLogger.Log("y", dtsod.ToString());
|
ColoredConsole.WriteLine("y", dtsod.ToString());
|
||||||
OldLogger.Log("g", "test completed");
|
ColoredConsole.WriteLine("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestSpeed()
|
public static void TestSpeed()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "-------[TestDtsodV23/TestSpeed]-------");
|
ColoredConsole.WriteLine("c", "-------[TestDtsodV23/TestSpeed]-------");
|
||||||
IDtsod dtsod=null;
|
IDtsod dtsod=null;
|
||||||
string text = File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}messages.dtsod");
|
string text = File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}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());
|
||||||
OldLogger.Log("g", "test completed");
|
ColoredConsole.WriteLine("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestMemoryConsumption()
|
public static void TestMemoryConsumption()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "----[TestDtsodV23/TestMemConsumpt]----");
|
ColoredConsole.WriteLine("c", "----[TestDtsodV23/TestMemConsumpt]----");
|
||||||
string text = File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}messages.dtsod");
|
string text = File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}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);
|
||||||
OldLogger.Log("b", "at the start: ","c",$"{a/1024} kb\n",
|
ColoredConsole.WriteLine("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");
|
||||||
OldLogger.Log("g", "test completed");
|
ColoredConsole.WriteLine("g", "test completed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,57 +18,57 @@ public static class TestDtsodV24
|
|||||||
|
|
||||||
public static void TestBaseTypes()
|
public static void TestBaseTypes()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "-----[TestDtsodV24/TestBaseTypes]-----");
|
Logger.Log("c", "-----[TestDtsodV24/TestBaseTypes]-----");
|
||||||
DtsodV24 dtsod = new(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV24{Path.Sep}base_types.dtsod"));
|
DtsodV24 dtsod = new(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV24{Path.Sep}base_types.dtsod"));
|
||||||
foreach (var pair in dtsod)
|
foreach (var pair in dtsod)
|
||||||
OldLogger.Log("b", pair.ToString());
|
Logger.Log("b", pair.ToString());
|
||||||
OldLogger.Log("g", "test completed");
|
Logger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestComplexes()
|
public static void TestComplexes()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "-----[TestDtsodV24/TestComplexes]-----");
|
Logger.Log("c", "-----[TestDtsodV24/TestComplexes]-----");
|
||||||
DtsodV24 dtsod = new(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV24{Path.Sep}complexes.dtsod"));
|
DtsodV24 dtsod = new(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV24{Path.Sep}complexes.dtsod"));
|
||||||
OldLogger.Log("h", dtsod.ToString());
|
Logger.Log("h", dtsod.ToString());
|
||||||
OldLogger.Log("g", "test completed");
|
Logger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestLists()
|
public static void TestLists()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "-------[TestDtsodV24/TestLists]-------");
|
Logger.Log("c", "-------[TestDtsodV24/TestLists]-------");
|
||||||
DtsodV24 dtsod = new(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV24{Path.Sep}lists.dtsod"));
|
DtsodV24 dtsod = new(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV24{Path.Sep}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);
|
||||||
OldLogger.Log("b", pair.key.HGlobalUTF8ToString(), "w", $" length: {list.Length}");
|
Logger.Log("b", pair.key.HGlobalUTF8ToString(), "w", $" length: {list.Length}");
|
||||||
foreach (var el in list)
|
foreach (var el in list)
|
||||||
{
|
{
|
||||||
OldLogger.Log("h", '\t' + el.ToString());
|
Logger.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)
|
||||||
{
|
{
|
||||||
OldLogger.Log($"\t\t{k.ToString()}");
|
Logger.Log($"\t\t{k.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OldLogger.Log("g", "test completed");
|
Logger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestReSerialization()
|
public static void TestReSerialization()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "--[TestDtsodV24/TestReSerialization]--");
|
Logger.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{Path.Sep}TestResources{Path.Sep}DtsodV24{Path.Sep}complexes.dtsod")).ToString()).ToString()).ToString());
|
new DtsodV24(File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV24{Path.Sep}complexes.dtsod")).ToString()).ToString()).ToString());
|
||||||
OldLogger.Log("h", dtsod.ToString());
|
Logger.Log("h", dtsod.ToString());
|
||||||
OldLogger.Log("g", "test completed");
|
Logger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestSpeed()
|
public static void TestSpeed()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "-------[TestDtsodV24/TestSpeed]-------");
|
Logger.Log("c", "-------[TestDtsodV24/TestSpeed]-------");
|
||||||
IDtsod dtsod=null;
|
IDtsod dtsod=null;
|
||||||
string _text = File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}messages.dtsod");
|
string _text = File.ReadAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV23{Path.Sep}messages.dtsod");
|
||||||
string text = "";
|
string text = "";
|
||||||
@ -78,7 +78,7 @@ public static class TestDtsodV24
|
|||||||
File.WriteAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV24{Path.Sep}messages.dtsod",text);
|
File.WriteAllText($"Dtsod{Path.Sep}TestResources{Path.Sep}DtsodV24{Path.Sep}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());
|
||||||
OldLogger.Log("g", "test completed");
|
Logger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@ -17,7 +17,7 @@ public static class TestPInvoke
|
|||||||
|
|
||||||
public static void TestUTF8()
|
public static void TestUTF8()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "--------[TestPInvoke/TestUTF8]--------", "b", "");
|
Logger.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++)
|
||||||
@ -25,7 +25,7 @@ public static class TestPInvoke
|
|||||||
ptr = Unmanaged.StringToHGlobalUTF8(str);
|
ptr = Unmanaged.StringToHGlobalUTF8(str);
|
||||||
str = Unmanaged.HGlobalUTF8ToString(ptr);
|
str = Unmanaged.HGlobalUTF8ToString(ptr);
|
||||||
}
|
}
|
||||||
OldLogger.Log("y", str);
|
Logger.Log("y", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("kerep", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("kerep", CallingConvention = CallingConvention.Cdecl)]
|
||||||
@ -33,9 +33,9 @@ public static class TestPInvoke
|
|||||||
|
|
||||||
public static void TestPrintf()
|
public static void TestPrintf()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "---------[TestPInvoke/Printf]---------", "b", "");
|
Logger.Log("c", "---------[TestPInvoke/Printf]---------", "b", "");
|
||||||
pinvoke_print("ъъ~ 中文");
|
pinvoke_print("ъъ~ 中文");
|
||||||
OldLogger.Log("g", "test completed");
|
Logger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("kerep", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("kerep", CallingConvention = CallingConvention.Cdecl)]
|
||||||
@ -43,12 +43,12 @@ public static class TestPInvoke
|
|||||||
|
|
||||||
public static unsafe void TestMarshalling()
|
public static unsafe void TestMarshalling()
|
||||||
{
|
{
|
||||||
OldLogger.Log("c", "---------[TestAutoarr/TestMarshalling]----------");
|
Logger.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;
|
||||||
OldLogger.Log("b", k.ToString());
|
Logger.Log("b", k.ToString());
|
||||||
OldLogger.Log("g", "test completed");
|
Logger.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@ -10,21 +10,24 @@ 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.Console;
|
global using DTLib.Console;
|
||||||
using DTLib.Logging.New;
|
global using DTLib.Logging;
|
||||||
|
|
||||||
namespace DTLib.Tests;
|
namespace DTLib.Tests;
|
||||||
|
|
||||||
public static class Program
|
public static class Program
|
||||||
{
|
{
|
||||||
public static Logging.ConsoleLogger OldLogger = new("logs", "DTLib.Tests");
|
public static ILogger Logger = new CompositeLogger(new ConsoleLogger(),
|
||||||
public static ILogger Logger;
|
new FileLogger("logs", "DTLib.Tests"))
|
||||||
|
|
||||||
|
{
|
||||||
|
DebugLogEnabled = true
|
||||||
|
};
|
||||||
|
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
System.Console.OutputEncoding = Encoding.UTF8;
|
System.Console.OutputEncoding = Encoding.UTF8;
|
||||||
System.Console.InputEncoding = Encoding.UTF8;
|
System.Console.InputEncoding = Encoding.UTF8;
|
||||||
Logger=new CompositeLogger(new ConsoleLogger(),
|
|
||||||
new FileLogger("logs", "DTLib.Tests"));
|
|
||||||
var mainContext = new ContextLogger("Main", Logger);
|
var mainContext = new ContextLogger("Main", Logger);
|
||||||
DTLibInternalLogging.SetLogger(Logger);
|
DTLibInternalLogging.SetLogger(Logger);
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,6 @@ public static class TesterLog
|
|||||||
operation();
|
operation();
|
||||||
clock.Stop();
|
clock.Stop();
|
||||||
double time=(double)(clock.ElapsedTicks)/Stopwatch.Frequency/repeats;
|
double time=(double)(clock.ElapsedTicks)/Stopwatch.Frequency/repeats;
|
||||||
PublicLog.Log("y",$"operation ","b",op_name,"y"," lasted ","b",time.ToString(MyTimeFormat.ForText),"y"," seconds");
|
InternalLog.Log("y",$"operation ","b",op_name,"y"," lasted ","b",time.ToString(MyTimeFormat.ForText),"y"," seconds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--package info-->
|
<!--package info-->
|
||||||
<PackageId>DTLib</PackageId>
|
<PackageId>DTLib</PackageId>
|
||||||
<Version>1.2.3</Version>
|
<Version>1.3.0</Version>
|
||||||
<Authors>Timerix</Authors>
|
<Authors>Timerix</Authors>
|
||||||
<Description>Library for all my C# projects</Description>
|
<Description>Library for all my C# projects</Description>
|
||||||
<RepositoryType>GIT</RepositoryType>
|
<RepositoryType>GIT</RepositoryType>
|
||||||
@ -38,4 +38,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="Experimental\ConsoleGUI\**" />
|
<Compile Remove="Experimental\ConsoleGUI\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Logging\" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -6,7 +6,7 @@ global using System.Text;
|
|||||||
global using System.Threading.Tasks;
|
global using System.Threading.Tasks;
|
||||||
global using DTLib.Extensions;
|
global using DTLib.Extensions;
|
||||||
global using DTLib.Filesystem;
|
global using DTLib.Filesystem;
|
||||||
global using static DTLib.Logging.PublicLog;
|
global using static DTLib.Logging.InternalLog;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
|||||||
@ -130,7 +130,7 @@ public static class StringConverter
|
|||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
// правильно реагирует на кавычки
|
/// правильно реагирует на кавычки
|
||||||
public static List<string> SplitToList(this string s, char c, char quot)
|
public static List<string> SplitToList(this string s, char c, char quot)
|
||||||
{
|
{
|
||||||
List<string> output = new();
|
List<string> output = new();
|
||||||
@ -158,7 +158,7 @@ public static class StringConverter
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// разбивает на части указанной длины
|
/// разбивает на части указанной длины
|
||||||
public static List<string> SplitToList(this string s, int length)
|
public static List<string> SplitToList(this string s, int length)
|
||||||
{
|
{
|
||||||
List<string> parts = new();
|
List<string> parts = new();
|
||||||
|
|||||||
@ -48,7 +48,7 @@ public class Hasher
|
|||||||
//var then = DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second;
|
//var then = DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second;
|
||||||
byte[] hash = xxh32.ComputeHash(fileStream);
|
byte[] hash = xxh32.ComputeHash(fileStream);
|
||||||
//var now = DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second;
|
//var now = DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second;
|
||||||
//PublicLog.Log($"xxh32 hash: {hash.HashToString()} time: {now - then}");
|
//InternalLog.Log($"xxh32 hash: {hash.HashToString()} time: {now - then}");
|
||||||
fileStream.Close();
|
fileStream.Close();
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// вывод логов со всех классов в библиотеке
|
/// вывод логов со всех классов в библиотеке
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class PublicLog
|
public static class InternalLog
|
||||||
{
|
{
|
||||||
public delegate void LogDelegate(params string[] msg);
|
public delegate void LogDelegate(params string[] msg);
|
||||||
// вот к этому объекту подключайте методы для вывода логов
|
// вот к этому объекту подключайте методы для вывода логов
|
||||||
@ -1,31 +0,0 @@
|
|||||||
using DTLib.Console;
|
|
||||||
|
|
||||||
namespace DTLib.Logging;
|
|
||||||
|
|
||||||
// вывод лога в консоль и файл
|
|
||||||
public class ConsoleLogger : FileLogger
|
|
||||||
{
|
|
||||||
public ConsoleLogger(string logfile) : base(logfile){}
|
|
||||||
public ConsoleLogger(string dir, string programName) : base(dir, programName) {}
|
|
||||||
|
|
||||||
|
|
||||||
readonly object consolelocker = new();
|
|
||||||
|
|
||||||
public override void Log(params string[] msg)
|
|
||||||
{
|
|
||||||
// write to file
|
|
||||||
base.Log(msg);
|
|
||||||
// append timestamp
|
|
||||||
var strb = new StringBuilder();
|
|
||||||
strb.Append('[').Append(LastLogMessageTime).Append("]: ");
|
|
||||||
int index = msg.Length == 1 ? 0 : 1;
|
|
||||||
strb.Append(msg[index]);
|
|
||||||
msg[index] = strb.ToString();
|
|
||||||
// write to console
|
|
||||||
lock (consolelocker)
|
|
||||||
{
|
|
||||||
ColoredConsole.Write(msg);
|
|
||||||
System.Console.WriteLine();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
namespace DTLib.Logging;
|
|
||||||
|
|
||||||
public class FileLogger : IDisposable
|
|
||||||
{
|
|
||||||
public FileLogger(string logfile)
|
|
||||||
{
|
|
||||||
LogfileName = logfile;
|
|
||||||
LogfileStream = File.OpenAppend(logfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileLogger(string dir, string programName)
|
|
||||||
: this($"{dir}{Path.Sep}{programName}_{DateTime.Now.ToString(MyTimeFormat.ForFileNames)}.log") { }
|
|
||||||
|
|
||||||
public string LogfileName { get; protected set; }
|
|
||||||
public System.IO.FileStream LogfileStream { get; protected set; }
|
|
||||||
protected string LastLogMessageTime;
|
|
||||||
|
|
||||||
|
|
||||||
public virtual void Log(params string[] msg)
|
|
||||||
{
|
|
||||||
lock (LogfileStream)
|
|
||||||
{
|
|
||||||
LastLogMessageTime = DateTime.Now.ToString(MyTimeFormat.ForText);
|
|
||||||
LogfileStream.FluentWriteString("[")
|
|
||||||
.FluentWriteString(LastLogMessageTime)
|
|
||||||
.FluentWriteString("]: ");
|
|
||||||
if (msg.Length == 1)
|
|
||||||
LogfileStream.FluentWriteString(msg[0]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var strb = new StringBuilder();
|
|
||||||
for (ushort i = 1; i < msg.Length; i += 2)
|
|
||||||
strb.Append(msg[i]);
|
|
||||||
LogfileStream.FluentWriteString(strb.ToString());
|
|
||||||
}
|
|
||||||
LogfileStream.FluentWriteString("\n").Flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LogfileStream?.Flush();
|
|
||||||
LogfileStream?.Close();
|
|
||||||
}
|
|
||||||
catch (ObjectDisposedException) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
~FileLogger() => Dispose();
|
|
||||||
}
|
|
||||||
@ -35,7 +35,7 @@
|
|||||||
<ProjectReference Include="..\DTLib.Dtsod\DTLib.Dtsod.csproj" />
|
<ProjectReference Include="..\DTLib.Dtsod\DTLib.Dtsod.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||||
<PackageReference Include="DTLib.Dtsod" Version="1.1.3" />
|
<PackageReference Include="DTLib" Version="1.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!--project files-->
|
<!--project files-->
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user