public Channel(TlcEnvironment root, ChannelProviderBase parent, string shortName, Action <IMessageSource, ChannelMessage> dispatch) : base(root, parent, shortName, dispatch) { Watch = Stopwatch.StartNew(); Root._consoleWriter.ChannelStarted(this); }
public OutputRedirector(TlcEnvironment env, TextWriter newOutWriter, TextWriter newErrWriter) { Contracts.AssertValue(env); Contracts.AssertValue(newOutWriter); Contracts.AssertValue(newErrWriter); _root = env.Root; _newConsoleWriter = new ConsoleWriter(_root, newOutWriter, newErrWriter); _oldConsoleWriter = Interlocked.Exchange(ref _root._consoleWriter, _newConsoleWriter); Contracts.AssertValue(_oldConsoleWriter); }
public ConsoleWriter(TlcEnvironment parent, TextWriter outWriter, TextWriter errWriter) { Contracts.AssertValue(parent); Contracts.AssertValue(outWriter); Contracts.AssertValue(errWriter); _lock = new object(); _parent = parent; _out = outWriter; _err = errWriter; _colorOut = outWriter == Console.Out; _colorErr = outWriter == Console.Error; }