Skip to content

Commit 881c357

Browse files
Standardize again CustomLogger and EndianTools.
Standardize again CustomLogger and EndianTools. Older Net Framework releases are mostly incompatible anyway.
1 parent f9a5137 commit 881c357

File tree

3 files changed

+4
-35
lines changed

3 files changed

+4
-35
lines changed
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net35</TargetFrameworks>
4+
<TargetFramework>netstandard2.0</TargetFramework>
55
<IsPublishable>false</IsPublishable>
66
</PropertyGroup>
77

8-
<ItemGroup Condition="'$(TargetFramework)' != 'net35'">
8+
<ItemGroup>
99
<PackageReference Include="Figgle" Version="0.5.1" />
1010
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
1111
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
@@ -15,8 +15,4 @@
1515
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
1616
</ItemGroup>
1717

18-
<ItemGroup Condition="'$(TargetFramework)' == 'net35'">
19-
<PackageReference Include="System.Threading.Tasks.Unofficial" Version="3.1.0" />
20-
</ItemGroup>
21-
2218
</Project>

BackendServices/CustomLogger/LoggerAccessor.cs

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
#if NETSTANDARD2_0_OR_GREATER
21
using Figgle;
32
using Microsoft.Extensions.Logging;
43
using NReco.Logging.File;
54
using Spectre.Console;
65
using Spectre.Console.Json;
7-
#endif
86
using System;
97
using System.IO;
108
using System.Threading;
@@ -31,8 +29,7 @@ public static void SetupLogger(string project, string CurrentDir)
3129
{
3230

3331
}
34-
35-
#if NETSTANDARD2_0_OR_GREATER
32+
3633
Directory.CreateDirectory(CurrentDir + $"/logs");
3734
Console.WriteLine(FiggleFonts.Ogre.Render(project));
3835

@@ -68,9 +65,6 @@ public static void SetupLogger(string project, string CurrentDir)
6865
builder.AddSimpleConsole(options => { options.SingleLine = true; options.TimestampFormat = "[MM-dd-yyyy HH:mm:ss] "; });
6966
}).CreateLogger(string.Empty);
7067
}
71-
#else
72-
Console.WriteLine(project + " Server is now starting!");
73-
#endif
7468

7569
#if DEBUG
7670
if (Environment.OSVersion.Platform == PlatformID.Win32NT
@@ -145,7 +139,6 @@ public static void DrawTextProgressBar(string text, int progress, int total, boo
145139
}
146140

147141
#pragma warning disable
148-
#if NETSTANDARD2_0_OR_GREATER
149142
public static ILogger Logger { get; set; }
150143
public static FileLoggerProvider _fileLogger = null;
151144
public static void LogInfo(string message) { Logger.LogInformation(message, null); }
@@ -182,26 +175,6 @@ public static void LogJson(string message, string header = "JSON Data")
182175
.RoundedBorder()
183176
.BorderColor(ConsoleColor.Gray));
184177
}
185-
#else
186-
public static void LogInfo(string message) { Console.WriteLine("\nINFO: " + message, null); }
187-
public static void LogInfo(string message, params object[] args) { Console.WriteLine("\nINFO: " + message, args); }
188-
public static void LogInfo(int? message, params object[] args) { Console.WriteLine("\nINFO: " + message.ToString(), args); }
189-
public static void LogInfo(float? message, params object[] args) { Console.WriteLine("\nINFO: " + message.ToString(), args); }
190-
public static void LogWarn(string message) { Console.WriteLine("\nWARN: " + message, null); }
191-
public static void LogWarn(string message, params object[] args) { Console.WriteLine("\nWARN: " + message, args); }
192-
public static void LogWarn(int? message, params object[] args) { Console.WriteLine("\nWARN: " + message.ToString(), args); }
193-
public static void LogWarn(float? message, params object[] args) { Console.WriteLine("\nWARN: " + message.ToString(), args); }
194-
public static void LogError(string message) { Console.WriteLine("\nERROR: " + message); }
195-
public static void LogError(string message, params object[] args) { Console.WriteLine("\nERROR: " + message, args); }
196-
public static void LogError(int? message, params object[] args) { Console.WriteLine("\nERROR: " + message.ToString(), args); }
197-
public static void LogError(float? message, params object[] args) { Console.WriteLine("\nERROR: " + message.ToString(), args); }
198-
public static void LogError(Exception exception) { Console.WriteLine("\nCRIT: " + exception.Message.ToString()); }
199-
public static void LogDebug(string message) { Console.WriteLine("\nDEBUG: " + message, null); }
200-
public static void LogDebug(string message, params object[] args) { Console.WriteLine("\nDEBUG: " + message, args); }
201-
public static void LogDebug(int? message, params object[] args) { Console.WriteLine("\nDEBUG: " + message.ToString(), args); }
202-
public static void LogDebug(float? message, params object[] args) { Console.WriteLine("\nDEBUG: " + message.ToString(), args); }
203-
public static void LogJson(string message, string header = "JSON Data") { Console.WriteLine($"\nJSON ({header}): \n" + message); }
204-
#endif
205178
#pragma warning restore
206179
}
207180
}

BackendServices/EndianTools/EndianTools.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard1.0;net35</TargetFrameworks>
4+
<TargetFramework>netstandard1.0</TargetFramework>
55
<IsPublishable>false</IsPublishable>
66
</PropertyGroup>
77

0 commit comments

Comments
 (0)