private static string StageToString(Logger.Stage s) { switch (s) { case Logger.Stage.INIT_MAIN: return("init main"); case Logger.Stage.RUN_MAIN: return("run main"); case Logger.Stage.CLEAN_MAIN: return("clean main"); case Logger.Stage.INIT_GFX: return("init gfx"); case Logger.Stage.RUN_GFX: return("run gfx"); case Logger.Stage.CLEAN_GFX: return("clean gfx"); case Logger.Stage.INIT_SOUND: return("init sound"); case Logger.Stage.RUN_SOUND: return("run sound"); case Logger.Stage.CLEAN_SOUND: return("clean sound"); default: return("misc"); } }
public static void WriteLine(Logger.Stage stage, string text) { lock (Logger.s_Mutex) { string str = string.Format("{0} {1} : {2}", (object)Logger.s_Lines.Count, (object)Logger.StageToString(stage), (object)text); Logger.s_Lines.Add(str); Console.Out.WriteLine(str); using (StreamWriter streamWriter = File.AppendText(Logger.LogFilePath())) { streamWriter.WriteLine(str); streamWriter.Flush(); } } }