public static void Initialize(bool withAppDomains) { if (withAppDomains) { // if we're using app domains, set up logging for this domain Console.SetOut(LogTextWriter.Create()); Console.SetError(LogTextWriter.Create()); // hook unhandled exception handler AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; } else { // we're not using app domains, so game initialization code will set up logging } }