1
- #if NETSTANDARD2_0_OR_GREATER
2
1
using Figgle ;
3
2
using Microsoft . Extensions . Logging ;
4
3
using NReco . Logging . File ;
5
4
using Spectre . Console ;
6
5
using Spectre . Console . Json ;
7
- #endif
8
6
using System ;
9
7
using System . IO ;
10
8
using System . Threading ;
@@ -31,8 +29,7 @@ public static void SetupLogger(string project, string CurrentDir)
31
29
{
32
30
33
31
}
34
-
35
- #if NETSTANDARD2_0_OR_GREATER
32
+
36
33
Directory . CreateDirectory ( CurrentDir + $ "/logs") ;
37
34
Console . WriteLine ( FiggleFonts . Ogre . Render ( project ) ) ;
38
35
@@ -68,9 +65,6 @@ public static void SetupLogger(string project, string CurrentDir)
68
65
builder . AddSimpleConsole ( options => { options . SingleLine = true ; options . TimestampFormat = "[MM-dd-yyyy HH:mm:ss] " ; } ) ;
69
66
} ) . CreateLogger ( string . Empty ) ;
70
67
}
71
- #else
72
- Console . WriteLine ( project + " Server is now starting!" ) ;
73
- #endif
74
68
75
69
#if DEBUG
76
70
if ( Environment . OSVersion . Platform == PlatformID . Win32NT
@@ -145,7 +139,6 @@ public static void DrawTextProgressBar(string text, int progress, int total, boo
145
139
}
146
140
147
141
#pragma warning disable
148
- #if NETSTANDARD2_0_OR_GREATER
149
142
public static ILogger Logger { get ; set ; }
150
143
public static FileLoggerProvider _fileLogger = null ;
151
144
public static void LogInfo ( string message ) { Logger . LogInformation ( message , null ) ; }
@@ -182,26 +175,6 @@ public static void LogJson(string message, string header = "JSON Data")
182
175
. RoundedBorder ( )
183
176
. BorderColor ( ConsoleColor . Gray ) ) ;
184
177
}
185
- #else
186
- public static void LogInfo ( string message ) { Console . WriteLine ( "\n INFO: " + message , null ) ; }
187
- public static void LogInfo ( string message , params object [ ] args ) { Console . WriteLine ( "\n INFO: " + message , args ) ; }
188
- public static void LogInfo ( int ? message , params object [ ] args ) { Console . WriteLine ( "\n INFO: " + message . ToString ( ) , args ) ; }
189
- public static void LogInfo ( float ? message , params object [ ] args ) { Console . WriteLine ( "\n INFO: " + message . ToString ( ) , args ) ; }
190
- public static void LogWarn ( string message ) { Console . WriteLine ( "\n WARN: " + message , null ) ; }
191
- public static void LogWarn ( string message , params object [ ] args ) { Console . WriteLine ( "\n WARN: " + message , args ) ; }
192
- public static void LogWarn ( int ? message , params object [ ] args ) { Console . WriteLine ( "\n WARN: " + message . ToString ( ) , args ) ; }
193
- public static void LogWarn ( float ? message , params object [ ] args ) { Console . WriteLine ( "\n WARN: " + message . ToString ( ) , args ) ; }
194
- public static void LogError ( string message ) { Console . WriteLine ( "\n ERROR: " + message ) ; }
195
- public static void LogError ( string message , params object [ ] args ) { Console . WriteLine ( "\n ERROR: " + message , args ) ; }
196
- public static void LogError ( int ? message , params object [ ] args ) { Console . WriteLine ( "\n ERROR: " + message . ToString ( ) , args ) ; }
197
- public static void LogError ( float ? message , params object [ ] args ) { Console . WriteLine ( "\n ERROR: " + message . ToString ( ) , args ) ; }
198
- public static void LogError ( Exception exception ) { Console . WriteLine ( "\n CRIT: " + exception . Message . ToString ( ) ) ; }
199
- public static void LogDebug ( string message ) { Console . WriteLine ( "\n DEBUG: " + message , null ) ; }
200
- public static void LogDebug ( string message , params object [ ] args ) { Console . WriteLine ( "\n DEBUG: " + message , args ) ; }
201
- public static void LogDebug ( int ? message , params object [ ] args ) { Console . WriteLine ( "\n DEBUG: " + message . ToString ( ) , args ) ; }
202
- public static void LogDebug ( float ? message , params object [ ] args ) { Console . WriteLine ( "\n DEBUG: " + message . ToString ( ) , args ) ; }
203
- public static void LogJson ( string message , string header = "JSON Data" ) { Console . WriteLine ( $ "\n JSON ({ header } ): \n " + message ) ; }
204
- #endif
205
178
#pragma warning restore
206
179
}
207
180
}
0 commit comments