/// <summary> /// Method that write on the log /// </summary> /// <param name="message"></param> public static void WriteOnTheLog(string message, Global.TipoLog tipoLog) { if (Global.log_system == Global.TipoLog.SIMPLES && tipoLog != Global.TipoLog.SIMPLES) { return; } string directory_ach = Global.app_logs_directoty; if (DateTime.Now.Day < 10) { directory_ach += "0" + DateTime.Now.Day; } else { directory_ach += DateTime.Now.Day; } if (DateTime.Now.Month < 10) { directory_ach += "0" + DateTime.Now.Month; } else { directory_ach += DateTime.Now.Month; } directory_ach += DateTime.Now.Year + ".log"; CL_Files file = new CL_Files(directory_ach); file.WriteOnTheEnd(DateTime.Now.ToString() + "- " + message + "\n"); file = null; }
/// <summary> /// Método que seta o Log /// </summary> public static void SetLog(Global.TipoLog tipo) { if (!ExistsTable("LOGG")) { CreateTable("CREATE TABLE LOGG( TIPO_LOG CHAR(1) DEFAULT '0' NOT NULL, PRIMARY KEY(TIPO_LOG))"); } if (!Select("SELECT 1 FROM LOGG").Read()) { Insert("INSERT INTO LOGG (TIPO_LOG) VALUES ('0')"); } Update("UPDATE LOGG SET TIPO_LOG = '" + (tipo == Global.TipoLog.DETALHADO ? '1' : '0') + "'"); }
/// <summary> /// Método que pega o tipo de sistema /// </summary> public static Global.TipoLog GetLog() { Global.TipoLog tipo = Global.TipoLog.SIMPLES; if (!ExistsTable("LOGG")) { CreateTable("CREATE TABLE LOGG( TIPO_LOG CHAR(1) DEFAULT '0' NOT NULL, PRIMARY KEY(TIPO_LOG))"); } if (Select("SELECT 1 FROM LOGG") != null) { if (!Select("SELECT 1 FROM LOGG").Read()) { Insert("INSERT INTO LOGG (TIPO_LOG) VALUES ('0')"); } } SQLiteDataReader reader = Select("SELECT TIPO_LOG FROM LOGG"); reader.Read(); tipo = (reader["TIPO_LOG"].ToString().Equals("0") ? Global.TipoLog.SIMPLES : Global.TipoLog.DETALHADO); reader.Close(); return(tipo); }