Add Logger.LogErrorDontIgnore()

This commit is contained in:
de4dot 2012-11-18 03:20:40 +01:00
parent 0e16e3e51b
commit 9a8218e68f
3 changed files with 14 additions and 10 deletions

View File

@ -86,6 +86,10 @@ namespace de4dot.code {
Log(true, sender, loggerEvent, format, args); Log(true, sender, loggerEvent, format, args);
} }
public void LogErrorDontIgnore(string format, params object[] args) {
Log(false, null, LoggerEvent.Error, format, args);
}
public void Log(bool canIgnore, object sender, LoggerEvent loggerEvent, string format, params object[] args) { public void Log(bool canIgnore, object sender, LoggerEvent loggerEvent, string format, params object[] args) {
if (IgnoresEvent(loggerEvent)) if (IgnoresEvent(loggerEvent))
return; return;

View File

@ -278,7 +278,7 @@ namespace de4dot.cui {
void exitError(string msg) { void exitError(string msg) {
usage(); usage();
Logger.Instance.Log(false, null, LoggerEvent.Error, "\n\nERROR: {0}\n", msg); Logger.Instance.LogErrorDontIgnore("\n\nERROR: {0}\n", msg);
exit(2); exit(2);
} }

View File

@ -88,22 +88,22 @@ namespace de4dot.cui {
exitCode = ex.code; exitCode = ex.code;
} }
catch (UserException ex) { catch (UserException ex) {
Logger.Instance.Log(false, null, LoggerEvent.Error, "ERROR: {0}", ex.Message); Logger.Instance.LogErrorDontIgnore("ERROR: {0}", ex.Message);
exitCode = 1; exitCode = 1;
} }
catch (Exception ex) { catch (Exception ex) {
if (printFullStackTrace()) { if (printFullStackTrace()) {
printStackTrace(ex); printStackTrace(ex);
Logger.Instance.Log(false, null, LoggerEvent.Error, "\nTry the latest version before reporting this problem!"); Logger.Instance.LogErrorDontIgnore("\nTry the latest version before reporting this problem!");
Logger.Instance.Log(false, null, LoggerEvent.Error, "Send bug reports to de4dot@gmail.com or go to https://github.com/0xd4d/de4dot/issues"); Logger.Instance.LogErrorDontIgnore("Send bug reports to de4dot@gmail.com or go to https://github.com/0xd4d/de4dot/issues");
} }
else { else {
Logger.Instance.Log(false, null, LoggerEvent.Error, "\n\n"); Logger.Instance.LogErrorDontIgnore("\n\n");
Logger.Instance.Log(false, null, LoggerEvent.Error, "Hmmmm... something didn't work. Try the latest version."); Logger.Instance.LogErrorDontIgnore("Hmmmm... something didn't work. Try the latest version.");
Logger.Instance.Log(false, null, LoggerEvent.Error, " EX: {0} : message: {1}", ex.GetType(), ex.Message); Logger.Instance.LogErrorDontIgnore(" EX: {0} : message: {1}", ex.GetType(), ex.Message);
Logger.Instance.Log(false, null, LoggerEvent.Error, "If it's a supported obfuscator, it could be a bug or a new obfuscator version."); Logger.Instance.LogErrorDontIgnore("If it's a supported obfuscator, it could be a bug or a new obfuscator version.");
Logger.Instance.Log(false, null, LoggerEvent.Error, "If it's an unsupported obfuscator, make sure the methods are decrypted!"); Logger.Instance.LogErrorDontIgnore("If it's an unsupported obfuscator, make sure the methods are decrypted!");
Logger.Instance.Log(false, null, LoggerEvent.Error, "Send bug reports to de4dot@gmail.com or go to https://github.com/0xd4d/de4dot/issues"); Logger.Instance.LogErrorDontIgnore("Send bug reports to de4dot@gmail.com or go to https://github.com/0xd4d/de4dot/issues");
} }
exitCode = 1; exitCode = 1;
} }