public static void Log <T, V>(T obj, V valueParam, string str, Exception ex, enLogLevel el) { if (((int)el) >= logLevel) { using (StreamWriter sw = new StreamWriter(logFileName, true)) { sw.WriteLine(); sw.WriteLine(DateTime.Now.ToString()); sw.WriteLine(string.Format("ErrorClass:{0}", obj.GetType().ToString())); sw.WriteLine(string.Format("ErrorLevel:{0}", (int)el)); sw.WriteLine(str); sw.WriteLine(ex == null ? "nothing" : ex.Message); sw.WriteLine(valueParam == null ? "Param is Null." : ConvertClass.CoverToJSON(valueParam)); } MessageBox.Show(ex == null ? "nothing" : ex.Message); } }