Exemple #1
0
        private static void Setup(
            out List <string> logLines,
            out IWriteBuffer <char> writeBuffer,
            out BlockingLoggingProducer blockingLoggingProducer,
            out ProducerWrapper <char> producer,
            CancellationTokenSource cts = null)
        {
            CancellationToken token = cts == null ? CancellationToken.None : cts.Token;

            logLines = new List <string>();
            ILogger log = MemoryLog.Create(logLines);

            // use a regular logging producer unless an override is passed in
            var factory = new BlockingLoggingProducerFactory(log);

            blockingLoggingProducer = factory.Instance;
            var channel = new UnboundedChannelFacade <char>();

            producer    = new ProducerWrapper <char>(factory, token, channel);
            writeBuffer = channel;
        }