@@ -38,6 +38,10 @@ internal static void Init() {
3838
3939 if ( LogToFile ) {
4040 lock ( FileLock ) {
41+ if ( ! LogToFile ) {
42+ return ;
43+ }
44+
4145 try {
4246 File . Delete ( Program . LogFile ) ;
4347 } catch ( Exception e ) {
@@ -48,23 +52,23 @@ internal static void Init() {
4852 }
4953 }
5054
51- internal static void LogGenericWTF ( string message , string botName = "Main" , [ CallerMemberName ] string previousMethodName = "" ) {
55+ internal static void LogGenericWTF ( string message , string botName = "Main" , [ CallerMemberName ] string previousMethodName = null ) {
5256 if ( string . IsNullOrEmpty ( message ) ) {
5357 return ;
5458 }
5559
5660 Log ( "[!!] WTF: " + previousMethodName + "() <" + botName + "> " + message + ", WTF?" ) ;
5761 }
5862
59- internal static void LogGenericError ( string message , string botName = "Main" , [ CallerMemberName ] string previousMethodName = "" ) {
63+ internal static void LogGenericError ( string message , string botName = "Main" , [ CallerMemberName ] string previousMethodName = null ) {
6064 if ( string . IsNullOrEmpty ( message ) ) {
6165 return ;
6266 }
6367
6468 Log ( "[!!] ERROR: " + previousMethodName + "() <" + botName + "> " + message ) ;
6569 }
6670
67- internal static void LogGenericException ( Exception exception , string botName = "Main" , [ CallerMemberName ] string previousMethodName = "" ) {
71+ internal static void LogGenericException ( Exception exception , string botName = "Main" , [ CallerMemberName ] string previousMethodName = null ) {
6872 if ( exception == null ) {
6973 return ;
7074 }
@@ -77,23 +81,23 @@ internal static void LogGenericException(Exception exception, string botName = "
7781 }
7882 }
7983
80- internal static void LogGenericWarning ( string message , string botName = "Main" , [ CallerMemberName ] string previousMethodName = "" ) {
84+ internal static void LogGenericWarning ( string message , string botName = "Main" , [ CallerMemberName ] string previousMethodName = null ) {
8185 if ( string . IsNullOrEmpty ( message ) ) {
8286 return ;
8387 }
8488
8589 Log ( "[!] WARNING: " + previousMethodName + "() <" + botName + "> " + message ) ;
8690 }
8791
88- internal static void LogGenericInfo ( string message , string botName = "Main" , [ CallerMemberName ] string previousMethodName = "" ) {
92+ internal static void LogGenericInfo ( string message , string botName = "Main" , [ CallerMemberName ] string previousMethodName = null ) {
8993 if ( string . IsNullOrEmpty ( message ) ) {
9094 return ;
9195 }
9296
9397 Log ( "[*] INFO: " + previousMethodName + "() <" + botName + "> " + message ) ;
9498 }
9599
96- internal static void LogNullError ( string nullObjectName , string botName = "Main" , [ CallerMemberName ] string previousMethodName = "" ) {
100+ internal static void LogNullError ( string nullObjectName , string botName = "Main" , [ CallerMemberName ] string previousMethodName = null ) {
97101 if ( string . IsNullOrEmpty ( nullObjectName ) ) {
98102 return ;
99103 }
@@ -102,7 +106,7 @@ internal static void LogNullError(string nullObjectName, string botName = "Main"
102106 }
103107
104108 [ Conditional ( "DEBUG" ) ]
105- internal static void LogGenericDebug ( string message , string botName = "Main" , [ CallerMemberName ] string previousMethodName = "" ) {
109+ internal static void LogGenericDebug ( string message , string botName = "Main" , [ CallerMemberName ] string previousMethodName = null ) {
106110 if ( string . IsNullOrEmpty ( message ) ) {
107111 return ;
108112 }
@@ -126,6 +130,10 @@ private static void Log(string message) {
126130
127131 if ( LogToFile ) {
128132 lock ( FileLock ) {
133+ if ( ! LogToFile ) {
134+ return ;
135+ }
136+
129137 try {
130138 File . AppendAllText ( Program . LogFile , loggedMessage ) ;
131139 } catch ( Exception e ) {
0 commit comments