File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -30,16 +30,37 @@ internal static class SharedTools
3030 {
3131 public static void LogWarning ( string ComponentName , string message , int LogSeverity = 1 )
3232 {
33- string ThreadName = System . Threading . Thread . CurrentThread . Name ?? String . Empty ;
34- if ( ThreadName . Length > 0 )
33+ string ThreadName = System . Threading . Thread . CurrentThread . Name ;
34+ if ( ! string . IsNullOrEmpty ( ThreadName ) )
3535 {
3636 message = $ "({ ThreadName } ) " + message ;
3737 }
38+ LogSeverity = Math . Max ( 0 , Math . Min ( LogSeverity , 2 ) ) ;
3839#if FEZCLIENT
3940 Common . Logger . Log ( ComponentName , ( Common . LogSeverity ) LogSeverity , message ) ;
4041#endif
41- Console . WriteLine ( "Warning: " + message ) ;
42- System . Diagnostics . Debug . WriteLine ( "Warning: " + message ) ;
42+ string msgType ;
43+ switch ( LogSeverity )
44+ {
45+ case 0 :
46+ msgType = "Information" ;
47+ break ;
48+ case 1 :
49+ msgType = "Warning" ;
50+ break ;
51+ case 2 :
52+ default :
53+ msgType = "Error" ;
54+ break ;
55+ }
56+ #if FEZCLIENT
57+ message = $ "{ msgType } : { message } ";
58+ #else
59+ string timestamp = DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss.fff" ) ;
60+ message = $ "{ timestamp } [{ msgType } ] { ComponentName } - { message } ";
61+ #endif
62+ Console . WriteLine ( message ) ;
63+ System . Diagnostics . Debug . WriteLine ( message ) ;
4364 }
4465 public static void ForceDisconnect ( this System . Net . Sockets . Socket socket )
4566 {
You can’t perform that action at this time.
0 commit comments