Example #1
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: private static void bulk(final java.util.LinkedList<Logger> remaining, final java.util.ArrayList<Logger> bulkLoggers, final System.Action<Logger> finalConsumer)
            internal static void Bulk(LinkedList <Logger> remaining, List <Logger> bulkLoggers, System.Action <Logger> finalConsumer)
            {
                if (remaining.Count > 0)
                {
                    Logger logger = remaining.pop();
                    logger.Bulk(bulkLogger =>
                    {
                        bulkLoggers.Add(bulkLogger);
                        Bulk(remaining, bulkLoggers, finalConsumer);
                    });
                }
                else
                {
                    Logger logger = new DuplicatingLogger(bulkLoggers);
                    finalConsumer(logger);
                }
            }
Example #2
0
        /// <param name="logs"> A list of <seealso cref="Log"/> instances that messages should be duplicated to </param>
        public DuplicatingLog(IList <Log> logs)
        {
            List <Logger> debugLoggers = new List <Logger>(logs.Count);
            List <Logger> infoLoggers  = new List <Logger>(logs.Count);
            List <Logger> warnLoggers  = new List <Logger>(logs.Count);
            List <Logger> errorLoggers = new List <Logger>(logs.Count);

            foreach (Log log in logs)
            {
                debugLoggers.Add(log.DebugLogger());
                infoLoggers.Add(log.InfoLogger());
                warnLoggers.Add(log.WarnLogger());
                errorLoggers.Add(log.ErrorLogger());
            }

            this._logs        = new CopyOnWriteArraySet <Log>(logs);
            this._debugLogger = new DuplicatingLogger(debugLoggers);
            this._infoLogger  = new DuplicatingLogger(infoLoggers);
            this._warnLogger  = new DuplicatingLogger(warnLoggers);
            this._errorLogger = new DuplicatingLogger(errorLoggers);
        }