public TestApp() { JsonLogger logger = new JsonLogger(); logger.LogError("Test error 1"); logger.LogDebug("Test debug 1"); logger.LogError(new LogObject("test 2")); logger.LogDebug(new LogObject("test debug 2")); logger.LogError(); logger.LogDebug(); }
private void PopulateRaces() { try { Races = Newtonsoft.Json.JsonConvert.DeserializeObject <List <DefaultRace> >(FileReader.ReadFile(FileHandlersCfg.FilePathRacesFile)); } catch (Exception e) { JLogger.LogError(e); JLogger.LogDebug("Races could not be found. Creating new default Races file."); } if (Races != null) { if (Races.Any()) { return; } } Races = new ListOfDefaultRaces(); string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(Races); FileWriter.WriteFile(FileHandlersCfg.FilePathRacesFile, jsonString); }
public static void TestConnection() { try { using (SqlConnection con = new SqlConnection(CONNECTIONSTRING)) { } } catch (Exception e) { JsonLogger _logger = new JsonLogger(); LogObject lo = new LogObject(e); _logger.LogError(lo); } }