You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using System; using System.Configuration; using System.IO; using System.Text;
namespace JMETxnPushScheduler.Business { public static class GetStatic { public static string ReadWebConfig(string key, string defValue) { return ConfigurationManager.AppSettings[key] ?? defValue; }
public static void WriteLog(string Log) { string LogFile = GetStatic.ReadAppSetting("LogFile"); StringBuilder LogText = new StringBuilder();
LogText.AppendLine(Log + DateTime.Now.ToString()); LogText.AppendLine("----------------------------------------------------------------------------"); Write(LogText.ToString());
using (StreamWriter writetext = new StreamWriter(LogFile, true)) { writetext.WriteLine(LogText.ToString()); } }
static void Write(string data) { Console.WriteLine(data); }
public static string ReadAppSetting(this string val) { try { return ConfigurationSettings.AppSettings[val].ToString(); } catch (Exception) { return ""; } } } }
|