[hyena] Log: make Exception() be higher severity (Error) if no msg is supplied



commit 3feafb7328154b3c4901e8e57b70b05d9b4c9105
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Sat Mar 1 23:55:24 2014 +0100

    Log: make Exception() be higher severity (Error) if no msg is supplied
    
    There are many places in apps in which Hyena.Log.Exception(ex)
    is used to prevent the app from crashing, so it is an unexpected
    exception, which should be raised as an error, not as a warning.
    
    If a message is supplied though, it could mean that the exception
    is expected to happen in an unlikely scenario, but not a bug.

 Hyena/Hyena/Log.cs |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/Hyena/Hyena/Log.cs b/Hyena/Hyena/Log.cs
index 64600f2..814d773 100644
--- a/Hyena/Hyena/Log.cs
+++ b/Hyena/Hyena/Log.cs
@@ -426,7 +426,11 @@ namespace Hyena
                 }
             }
 
-            Log.Warning (message ?? "Caught an exception", builder.ToString (), false);
+            if (message != null) {
+                Log.Warning (message, builder.ToString (), false);
+            } else {
+                Log.Error ("Caught an exception", builder.ToString (), false);
+            }
         }
 
         #endregion


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]