/// <summary> /// Metodo para efetuar log em arquivo texto /// </summary> /// <param name="classe"></param> /// <param name="message"></param> public static void LOGGER(String classe, String message) { DateTime now = DateTime.Now; StringBuilder fileName = new StringBuilder(); fileName.Append(now.Year).Append(now.Month).Append(now.Day); string file = PropertiesUtil.getInstance().getProperties("xml2rfax_log").Replace("{0}", fileName.ToString()); try { if (!File.Exists(file)) { FileStream arquivo = File.Create(file); arquivo.Close(); } using (StreamWriter txtWriter = File.AppendText(file)) { StringBuilder log = new StringBuilder(); log.Append(now.ToLongTimeString()); log.Append(" ").Append(classe); log.Append(" - ").Append(message); txtWriter.WriteLine(log.ToString()); } } catch (Exception) { } }
/// <summary> /// Metodo para construir a formacao do PATH do diretorio de XML analisados /// </summary> /// <param name="fileName">String</param> /// <returns>String</returns> public static String pathXMLSouce(String fileName) { StringBuilder arquivo = new StringBuilder(); arquivo.Append(PropertiesUtil.getInstance().getProperties("dir_xml_analisar")); arquivo.Append("\\"); arquivo.Append(fileName); arquivo.Append(".xml"); return(arquivo.ToString()); }
/// <summary> /// Retorna instancia unica da classe /// </summary> /// <returns>PropertiesUtil</returns> public static PropertiesUtil getInstance() { try { if (propertiesUtil == null) { propertiesUtil = new PropertiesUtil(); } } catch (Exception e) { Logger.LOGGER_ERROR(e.Message); throw new NullReferenceException(); } return(propertiesUtil); }