public static void SaveMessage(string msg, Exception ex, object obj, TypeLog type) { try { Message message = new Message(); message.Msg = msg; if (ex != null) { message.Exception = ex.ToString(); } message.TypeLog = type; StackTrace stack = new StackTrace(); var frames = stack.GetFrames(); foreach (var item in frames) { if (!(item.GetMethod().DeclaringType.Name == "Log" && item.GetMethod().DeclaringType.Namespace == "Logger")) { message.Method = item.GetMethod().ToString(); message.Class = item.GetMethod().DeclaringType.Name; message.Line = item.GetFileLineNumber(); break; } } if ((Params.OutputLog & OutputLog.Text) == OutputLog.Text) { SaveMessageText(message); } if ((Params.OutputLog & OutputLog.SQLite) == OutputLog.SQLite) { int idtTypeObj = 0; int idObj = 0; if (obj != null) { Type typeObj = obj.GetType(); Hashtable colluns; if (obj.GetType() == typeof(Hashtable)) { colluns = (Hashtable)obj; } else { colluns = SerializeObject(obj); } idObj = business.InsertObject(typeObj.Name, colluns, out idtTypeObj); } int idAppliction = business.InsertApplication(); message.IdApplication = idAppliction; message.IdObject = idObj; message.IdTypeObject = idtTypeObj; business.InsertMessage(message); } } catch (Exception exception) { } }