public static void LogAIError(Exception ex, databaseCache cache) { //Save the cache for later checking and try again WebLogging.AddLog("GPA", WebLogging.LogCategory.AIError, "AI error logged - " + ex.ToString()); string errorFileName = "pokerAIError " + DateTime.Now.Hour.ToString() + "." + DateTime.Now.Minute.ToString() + "." + DateTime.Now.Second.ToString() + "." + DateTime.Now.Millisecond.ToString() + " " + DateTime.Now.ToString("dd-MM-yyyy"); using (System.IO.StreamWriter sw = new System.IO.StreamWriter(errorFileName + ".log", false)) { sw.WriteLine("Hand Id: " + cache.getCurrentHandId().ToString() + " Player Id: " + cache.getPlayerId(cache.getCurrentActiveTablePosition()).ToString()); if (ex.GetBaseException() != null) { sw.WriteLine("Base Exception Type: " + ex.GetBaseException().ToString()); } if (ex.InnerException != null) { sw.WriteLine("Inner Exception Type: " + ex.InnerException.ToString()); } if (ex.StackTrace != null) { sw.WriteLine(""); sw.WriteLine("Stack Trace: " + ex.StackTrace.ToString()); } File.WriteAllBytes(errorFileName + ".FBPcache", cache.Serialise()); sw.Close(); } }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { WebLogging.ConfigureLogger(loggerFactory); WebLogging.LoggerFactory = loggerFactory; if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } env.ContentRootFileProvider = new Microsoft.Extensions.FileProviders.NullFileProvider(); env.ContentRootPath = null; app.UseOwin(x => x.UseNancy(opt => opt.Bootstrapper = new NancyBootstrapper())); }