There are quite a few things iI am considering:
I will have to check for null values
I will have to check fornull
valuesI will have serious trouble persisting it in the database. How do i improve this or re-factor this for better results ?
public class ErrorLog { public static void LogError(Exception e) { var exceptionLog = new Dictionary<String, String> { {"Inner Exception", e.InnerException.Message}, {"Message", e.Message}, {"Source", e.Source}, {"StackTrace", e.StackTrace}, {"MethodName",e.TargetSite.Name} }; foreach (KeyValuePair<String, String> kvp in e.Data) exceptionLog.Add(kvp.Key, kvp.Value); } }
I will have serious trouble persisting it in the database.
How do I improve this or re-factor this for better results?
public class ErrorLog
{
public static void LogError(Exception e)
{
var exceptionLog = new Dictionary<String, String>
{
{"Inner Exception", e.InnerException.Message},
{"Message", e.Message},
{"Source", e.Source},
{"StackTrace", e.StackTrace},
{"MethodName",e.TargetSite.Name}
};
foreach (KeyValuePair<String, String> kvp in e.Data)
exceptionLog.Add(kvp.Key, kvp.Value);
}
}
Now what if there is an error in updating this log , how will iI log that ?