/// <summary> /// Use this method to override the default <see cref="RuntimeLogWriter"/> /// for logging runtime messages. /// </summary> public RuntimeLogWriter SetLogWriter(RuntimeLogWriter logWriter) { var logger = this.LogWriter.Logger; var prevLogWriter = this.LogWriter; this.LogWriter = logWriter ?? throw new InvalidOperationException("Cannot install a null log writer."); this.SetLogger(logger); return(prevLogWriter); }
/// <summary> /// Initializes a new instance of the <see cref="MachineRuntime"/> class. /// </summary> protected MachineRuntime(Configuration configuration) { this.Configuration = configuration; this.MachineMap = new ConcurrentDictionary <MachineId, AsyncMachine>(); this.MachineIdCounter = 0; this.LogWriter = new RuntimeLogWriter { Logger = configuration.IsVerbose ? (ILogger) new ConsoleLogger() : new NulLogger() }; this.IsRunning = true; }