diff --git a/DTLib.Dtsod/DTLib.Dtsod.csproj b/DTLib.Dtsod/DTLib.Dtsod.csproj index 7598b4e..a640e03 100644 --- a/DTLib.Dtsod/DTLib.Dtsod.csproj +++ b/DTLib.Dtsod/DTLib.Dtsod.csproj @@ -2,7 +2,7 @@ DTLib.Dtsod - 1.3.0 + 1.3.1 Timerix Definitely not json GIT @@ -11,7 +11,7 @@ Release MIT - netstandard2.0;net48;net6.0;net7.0 + netstandard2.0;net6.0;net7.0;net8.0 embedded 11 @@ -33,7 +33,7 @@ - + diff --git a/DTLib.Dtsod/DtsodConverter.cs b/DTLib.Dtsod/DtsodConverter.cs index d967f65..0ccf7ea 100644 --- a/DTLib.Dtsod/DtsodConverter.cs +++ b/DTLib.Dtsod/DtsodConverter.cs @@ -16,12 +16,12 @@ public static class DtsodConverter }; // заменяет дефолтные значения на пользовательские - public static DtsodV23 UpdateByDefault(DtsodV23 old, DtsodV23 updatedDefault, string contextName="") + public static DtsodV23 UpdateByDefault(DtsodV23 old, DtsodV23 updatedDefault, string contextName = "") { DtsodV23 updated = new(); - foreach (KeyValuePair p in updatedDefault) + foreach (KeyValuePair p in updatedDefault) { - string keyWithContext=contextName+"."+p.Key; + string keyWithContext = contextName + "." + p.Key; if (old.TryGetValue(p.Key, out var oldValue)) { if (oldValue.GetType() != p.Value.GetType()) @@ -29,29 +29,18 @@ public static class DtsodConverter "uncompatible config value type\n " + $"<{keyWithContext}>: {oldValue} is {oldValue.GetType()}, " + $"must be {p.Value.GetType()}"); - else + if (oldValue is DtsodV23) { - if(oldValue!=p.Value) - Log("y", $"<{keyWithContext}> old: {oldValue} new: {p.Value}"); - if(oldValue is DtsodV23){ - var subdtsod=UpdateByDefault(oldValue, p.Value, keyWithContext); - updated.Add(p.Key,subdtsod); - } - else if(oldValue is IList) - { - Log("y", $"can't automatically update list <{keyWithContext}>, do it manually"); - updated.Add(p.Key,oldValue); - } - else updated.Add(p.Key,oldValue); + var subdtsod = UpdateByDefault(oldValue, p.Value, keyWithContext); + updated.Add(p.Key, subdtsod); } + else if (oldValue is IList) + updated.Add(p.Key, oldValue); + else updated.Add(p.Key, oldValue); } - else - { - Log("y", $"<{keyWithContext}> new: {p.Value}"); - updated.Add(p.Key,p.Value); - } + else updated.Add(p.Key, p.Value); } return updated; } -} +} \ No newline at end of file diff --git a/DTLib.Dtsod/DtsodV23.cs b/DTLib.Dtsod/DtsodV23.cs index 40f4f50..7ddfe99 100644 --- a/DTLib.Dtsod/DtsodV23.cs +++ b/DTLib.Dtsod/DtsodV23.cs @@ -213,7 +213,6 @@ public class DtsodV23 : DtsodDict, IDtsod } catch (FormatException) { - Log("r", $"can't parse value: {value_str}"); return null; } } diff --git a/DTLib.Dtsod/IDtsod.cs b/DTLib.Dtsod/IDtsod.cs index 314b28a..b071241 100644 --- a/DTLib.Dtsod/IDtsod.cs +++ b/DTLib.Dtsod/IDtsod.cs @@ -4,7 +4,6 @@ global using System.Collections.Generic; global using System.Linq; global using System.Text; global using DTLib.Extensions; -global using static DTLib.Logging.InternalLog; namespace DTLib.Dtsod; diff --git a/DTLib.Logging/DTLib.Logging.csproj b/DTLib.Logging/DTLib.Logging.csproj index 8a5d63b..935cee4 100644 --- a/DTLib.Logging/DTLib.Logging.csproj +++ b/DTLib.Logging/DTLib.Logging.csproj @@ -2,7 +2,7 @@ DTLib.Logging - 1.3.0 + 1.3.1 Timerix Loggers with dependency injection GIT @@ -11,7 +11,7 @@ Release MIT - netstandard2.0;net48;net6.0;net7.0 + netstandard2.0;net6.0;net7.0;net8.0 embedded 10 @@ -30,7 +30,7 @@ - + diff --git a/DTLib.Logging/DTLibInternalLogging.cs b/DTLib.Logging/DTLibInternalLogging.cs deleted file mode 100644 index a2cd523..0000000 --- a/DTLib.Logging/DTLibInternalLogging.cs +++ /dev/null @@ -1,37 +0,0 @@ -global using System; -global using System.Collections; -global using System.Collections.Generic; -global using System.Runtime.CompilerServices; -global using System.Linq; -global using System.Text; -global using System.Threading.Tasks; -global using DTLib.Extensions; -global using DTLib.Filesystem; - -namespace DTLib.Logging; - -/// this class can be used to setup logger for DTLib debug log messages -public static class DTLibInternalLogging -{ - private static ContextLogger _loggerContext; - - public static void SetLogger(ILogger logger) - { - _loggerContext = new ContextLogger("DTLib",logger); - InternalLog.LogEvent+=LogHandler; - } - - private static void LogHandler(string[] msg) - { - if (msg.Length == 1) - { - _loggerContext.LogDebug(msg[0]); - return; - } - - StringBuilder b = new(); - for (int i = 1; i < msg.Length; i++) - b.Append(msg[i]); - _loggerContext.LogDebug(b.ToString()); - } -} \ No newline at end of file diff --git a/DTLib.Logging/DependencyInjection/MyLoggerWrapper.cs b/DTLib.Logging/DependencyInjection/MyLoggerWrapper.cs index 653f127..d692882 100644 --- a/DTLib.Logging/DependencyInjection/MyLoggerWrapper.cs +++ b/DTLib.Logging/DependencyInjection/MyLoggerWrapper.cs @@ -1,4 +1,3 @@ -using DTLib.Logging; using Microsoft.Extensions.Logging; // ReSharper disable RedundantNameQualifier diff --git a/DTLib.Logging/GlobalUsings.cs b/DTLib.Logging/GlobalUsings.cs new file mode 100644 index 0000000..87738db --- /dev/null +++ b/DTLib.Logging/GlobalUsings.cs @@ -0,0 +1,8 @@ +global using System; +global using System.Collections.Generic; +global using System.Runtime.CompilerServices; +global using System.Linq; +global using System.Text; +global using System.Threading.Tasks; +global using DTLib.Extensions; +global using DTLib.Filesystem; diff --git a/DTLib.Network/DTLib.Network.csproj b/DTLib.Network/DTLib.Network.csproj index 14c3def..cec6661 100644 --- a/DTLib.Network/DTLib.Network.csproj +++ b/DTLib.Network/DTLib.Network.csproj @@ -11,7 +11,7 @@ Release MIT - netstandard2.0;net48;net6.0;net7.0 + netstandard2.0;net6.0;net7.0;net8.0 embedded 10 @@ -32,6 +32,6 @@ - + diff --git a/DTLib.Tests/DTLib.Tests.csproj b/DTLib.Tests/DTLib.Tests.csproj index f7a1936..db150fa 100644 --- a/DTLib.Tests/DTLib.Tests.csproj +++ b/DTLib.Tests/DTLib.Tests.csproj @@ -2,7 +2,7 @@ Exe - netstandard2.0;net48;net6.0;net7.0 + netstandard2.0;net6.0;net7.0;net8.0 embedded 10 @@ -27,10 +27,10 @@ - - - - + + + + diff --git a/DTLib.Tests/Program.cs b/DTLib.Tests/Program.cs index 7717ab5..639da90 100644 --- a/DTLib.Tests/Program.cs +++ b/DTLib.Tests/Program.cs @@ -29,7 +29,6 @@ public static class Program System.Console.OutputEncoding = Encoding.UTF8; System.Console.InputEncoding = Encoding.UTF8; var mainContext = new ContextLogger("Main", Logger); - DTLibInternalLogging.SetLogger(Logger); try { diff --git a/DTLib.Tests/Tester.cs b/DTLib.Tests/Tester.cs index 2214514..c00520b 100644 --- a/DTLib.Tests/Tester.cs +++ b/DTLib.Tests/Tester.cs @@ -1,5 +1,4 @@ using System.Diagnostics; -using DTLib.Logging; namespace DTLib.Tests; @@ -13,6 +12,6 @@ public static class TesterLog operation(); clock.Stop(); double time=(double)(clock.ElapsedTicks)/Stopwatch.Frequency/repeats; - InternalLog.Log("y",$"operation ","b",op_name,"y"," lasted ","b",time.ToString(MyTimeFormat.ForText),"y"," seconds"); + Logger.LogInfo(nameof(TesterLog), $"operation {op_name} lasted {time.ToString(MyTimeFormat.ForText)} seconds"); } } \ No newline at end of file diff --git a/DTLib/DTLib.csproj b/DTLib/DTLib.csproj index fe21d0f..66abb31 100644 --- a/DTLib/DTLib.csproj +++ b/DTLib/DTLib.csproj @@ -2,7 +2,7 @@ DTLib - 1.3.0 + 1.3.1 Timerix Library for all my C# projects GIT @@ -11,7 +11,7 @@ Release MIT - netstandard2.0;net48;net6.0;net7.0 + netstandard2.0;net6.0;net7.0;net8.0 embedded diff --git a/DTLib/DependencyResolver.cs b/DTLib/DependencyResolver.cs index fe6d96e..2f721d1 100644 --- a/DTLib/DependencyResolver.cs +++ b/DTLib/DependencyResolver.cs @@ -42,7 +42,6 @@ public static class DependencyResolver { var extracted = file.Substring(file.LastIndexOf(Path.Sep) + 1); File.Copy(file, extracted, true); - Log("g", $"{file} extracted"); } DepsCopied = true; diff --git a/DTLib/Extensions/BaseConverter.cs b/DTLib/Extensions/BaseConverter.cs index bca17ed..c41336d 100644 --- a/DTLib/Extensions/BaseConverter.cs +++ b/DTLib/Extensions/BaseConverter.cs @@ -6,7 +6,6 @@ global using System.Text; global using System.Threading.Tasks; global using DTLib.Extensions; global using DTLib.Filesystem; -global using static DTLib.Logging.InternalLog; using System.Globalization; using System.Runtime.CompilerServices; diff --git a/DTLib/InternalLog.cs b/DTLib/InternalLog.cs deleted file mode 100644 index e186d78..0000000 --- a/DTLib/InternalLog.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace DTLib.Logging; - -/// -/// вывод логов со всех классов в библиотеке -/// -public static class InternalLog -{ - public delegate void LogDelegate(params string[] msg); - // вот к этому объекту подключайте методы для вывода логов - public static event LogDelegate LogEvent; - public static void Log(params string[] msg) => LogEvent?.Invoke(msg); -} diff --git a/KerepWrapper/KerepWrapper.csproj b/KerepWrapper/KerepWrapper.csproj index 20a419f..34fe341 100644 --- a/KerepWrapper/KerepWrapper.csproj +++ b/KerepWrapper/KerepWrapper.csproj @@ -12,7 +12,7 @@ Release MIT - netstandard2.0;net48;net6.0;net7.0 + netstandard2.0;net6.0;net7.0;net8.0 embedded 10 @@ -35,7 +35,7 @@ - +