void Start() { // setup reference to logging system logger = GameObject.Find("LoggingSystem").GetComponent <LoggingSystem> (); if (logger == null) { Debug.Log("[LoggingDemo] Unable to set reference to Logging System."); } }
/// <summary> /// /// </summary> static void LoggingExample() { try { throw new Exception("This is my exception"); } catch (Exception ex) { LoggingSystem.LogError(ex, "Main - LoggingExample"); Trace.WriteLine("exception logged!"); } }
public OctoGameCommand(UserAccounts accounts, SpellUserAccounts spellAccounts, AwaitForUserMessage awaitForUserMessage, LoggingSystem loggingSystem, GameFramework gameFramework, DiscordShardedClient client, OctoGameUpdateMess octoGameUpdateMess, Global global) { _accounts = accounts; _spellAccounts = spellAccounts; _awaitForUserMessage = awaitForUserMessage; _loggingSystem = loggingSystem; _gameFramework = gameFramework; _client = client; _octoGameUpdateMess = octoGameUpdateMess; _global = global; }
private static int ParseMailTopic(string topic, string logFileName) { string log = string.Empty; if (!topic.Contains(":")) { LoggingSystem.LogMessageToFile( "Тема письма не содержит разделитель ':', пропуск", ref log, false, logFileName); return(-1); } string[] state = topic.Split(':'); if (state.Length != 2) { LoggingSystem.LogMessageToFile( "Заголовок письма имеет неверный формат: '" + topic + "', пропуск", ref log, false, logFileName); return(-1); } string vpnState = state[1].ToLower(); if (vpnState.Equals("true")) { return(0); } else if (vpnState.Equals("false")) { return(1); } else { LoggingSystem.LogMessageToFile( "Неизвестный статус: " + state, ref log, false, logFileName); } return(-1); }
static void Main(string[] args) { #region Logging into console and File const string fileName = "TextLogger.txt"; if (File.Exists(fileName)) { File.Delete(fileName); } Trace.Listeners.Clear(); var twtl = new TextWriterTraceListener(fileName) { Name = fileName.Substring(0, fileName.IndexOf('.')), TraceOutputOptions = TraceOptions.ThreadId | TraceOptions.DateTime, }; var ctl = new ConsoleTraceListener(false) { TraceOutputOptions = TraceOptions.DateTime }; Trace.Listeners.Add(twtl); Trace.Listeners.Add(ctl); Trace.AutoFlush = true; #endregion #region Setting the db connection ShuraSimpleCMSDatabase.ConnectionString = Connection; #endregion //Testing methods calls goes here //Inserting... // ShuraSimpleCMSDatabase.ClsLookupTitles lt = new ShuraSimpleCMSDatabase.ClsLookupTitles(); //ShuraSimpleCMSDatabase.ClsLookupTitles lt1 = new ShuraSimpleCMSDatabase.ClsLookupTitles(); // This is to Select something then out it in object of ClsLookupTitles // ShuraSimpleCMSDatabase.ClsLookupTitles.Functions.GetRecord("[lt_Id] = 1", out lt1); //lt.lt_Id = 6; //lt.Delete(); // Trace.WriteLine( Shura.SimpleCMS.Logic.Utility.RandomGenerator.Next(20)); //string UCanTry = Getmd5("hassan"); //Trace.WriteLine("this is UCanTry : " + UCanTry); using (DataTable dt = new DataTable("test")) { dt.Columns.Add("ID", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Rows.Add(55, "hassan"); dt.Rows.Add(22, "mohamed"); dt.Rows.Add(11, "ahmed"); dt.Rows.Add(55, "badry"); foreach (DataRow dr in dt.Rows) { Trace.WriteLine("Name =" + dr["Name"] + " ID=" + dr["ID"]); } } //dt = city.GetAllCity();//your datatable //string attachment = "attachment; filename=city.xls"; //Response.ClearContent(); //Response.AddHeader("content-disposition", attachment); //Response.ContentType = "application/vnd.ms-excel"; //string tab = ""; //foreach (DataColumn dc in dt.Columns) //{ // Response.Write(tab + dc.ColumnName); // tab = "\t"; //} //Response.Write("\n"); //int i; //foreach (DataRow dr in dt.Rows) //{ // tab = ""; // for (i = 0; i < dt.Columns.Count; i++) // { // Response.Write(tab + dr[i].ToString()); // tab = "\t"; // } // Response.Write("\n"); //} //Response.End(); LoggingSystem.LogError("erorr"); System.Console.ReadKey(); //TestDeva1(); //TestDeva2(); LoggingExample(); }
public void login_Button() //logging button { LoggingSystem login_system = new LoggingSystem(_user.login_TextBox, _user.password_TextBox); MessageBox.Show(login_system.Login_Passing()); }
static int Main(string[] args) { string log = string.Empty; string logFileName = string.Join(", ", args); LoggingSystem.LogMessageToFile( "---Запуск VPNStateConverter", ref log, false, logFileName); LoggingSystem.LogMessageToFile( "---Возможные результаты работы: 0 - ok, 1 - error, 2 - unknown, -1 parsing error", ref log, false, logFileName); int retValue = 2; //0 - ok, 1 - error, 2 - unknown, -1 parsing error DateTime?mailCreateDate = null; string vpnAddress = string.Empty; if (args.Length != 1) { LoggingSystem.LogMessageToFile( "Для запуска необходимо передать один параметр с адресом VPN сервера", ref log, false, logFileName); Console.WriteLine(retValue); return(retValue); } else { vpnAddress = args[0]; } try { LoggingSystem.LogMessageToFile( "Подключение к почтовому ящику", ref log, false, logFileName); ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013) { Credentials = new WebCredentials( Properties.Settings.Default.UserName, Properties.Settings.Default.UserPassword, Properties.Settings.Default.UserDomain), Url = new Uri(Properties.Settings.Default.EWS) }; LoggingSystem.LogMessageToFile("Проверка папки 'Входящие'", ref log, false, logFileName); Folder inbox = Folder.Bind(service, WellKnownFolderName.Inbox); if (inbox.TotalCount > 0) { ItemView view = new ItemView(inbox.TotalCount) { PropertySet = PropertySet.IdOnly }; FindItemsResults <Item> results = service.FindItems(inbox.Id, view); LoggingSystem.LogMessageToFile("Количество писем в папке: " + results.TotalCount, ref log, false, logFileName); foreach (Item item in results.Items) { try { EmailMessage email = EmailMessage.Bind(service, new ItemId(item.Id.UniqueId.ToString())); string topic = email.ConversationTopic; if (!topic.ToLower().Contains(vpnAddress)) { continue; } DateTime mailCurrentCreateDate = email.DateTimeCreated; LoggingSystem.LogMessageToFile("Обработка письма: '" + topic + "', дата создания: " + mailCurrentCreateDate.ToString(), ref log, false, logFileName); if (((DateTime.Now - mailCurrentCreateDate).TotalHours >= 1) || (mailCreateDate.HasValue && (mailCreateDate.Value > mailCurrentCreateDate))) { LoggingSystem.LogMessageToFile("Пропуск обработки, время создания устарело", ref log, false, logFileName); } else { retValue = ParseMailTopic(topic, logFileName); mailCreateDate = mailCurrentCreateDate; } email.Delete(DeleteMode.HardDelete); email.Update(ConflictResolutionMode.AlwaysOverwrite); } catch (Exception e) { LoggingSystem.LogMessageToFile("Возникла ошибка: " + e.Message + Environment.NewLine + e.StackTrace, ref log, false, logFileName); } } } else { LoggingSystem.LogMessageToFile("Папка не содержит писем", ref log, false, logFileName); } } catch (Exception e) { LoggingSystem.LogMessageToFile("Возникла ошибка: " + e.Message + Environment.NewLine + e.StackTrace, ref log, false, logFileName); } LoggingSystem.LogMessageToFile("===Окончание обработки, возвращаемое значение: " + retValue, ref log, false, logFileName); Console.WriteLine(retValue); return(retValue); }