public OutputManager(Framework framework, string path = null) { Framework = framework; this.textWriter = Console.Out; if (path != null) { path = path.Replace("%d", DateTime.Now.ToString("ddMMyyHHmmss")); path = path.Replace("%n", framework.Name); try { this.streamWriter = File.CreateText(path); this.streamWriter.AutoFlush = true; } catch (Exception) { Console.WriteLine($"OutputManager::OutputManager Error. Can not open output log file {path}"); this.streamWriter = null; } } this.outputWriter = new OutputWriter(this); Console.SetOut(this.outputWriter); }