Skip to content

Commit

Permalink
removed unneeded try-catch while writing to file in C_LoggingHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
derco0n committed Apr 27, 2022
1 parent 266aaf2 commit ae0ba3d
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions Co0nUtilZ/C_LoggingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,11 @@ private bool TryWriteLog(String msg, EventLogEntryType Type, UInt16 Messagenumbe
{ //An error occured while writing to the event-log
if (this._OnErrorLogToFile)
{ //as OnErrorlogtoFile is set, we write log and error down to a file within user's appdata\roaming
try
{
string prefix = "coonutils_logexceptions";
string targetfile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "logs", prefix, "logerror_" +
String.Format("{0:yyyyMMdd_HH-mm-ss}", DateTime.Now) + "_" + Assembly.GetEntryAssembly().GetName().Name);
msg="The following error occured while logging to eventlog -> " + ex.Message + "\r\n\r\nStacktrace:\r\n" + ex.StackTrace + "\r\n\r\n Dumping original logmessage below:\r\n" + msg;
this.logtofile(targetfile, msg, 30, prefix);
}
catch
{
//giving up, as text file can't be written either
}

}
return false; //as we were unable to write to the eventlog, return false...
}
Expand Down

0 comments on commit ae0ba3d

Please sign in to comment.