Exemplo n.º 1
0
        /// <summary>
        /// Apply additional context to the parser, using a specific config to modify parsing.
        /// </summary>
        /// <param name="parser">The parser to apply context to.</param>
        /// <param name="configName">The specific config to apply.</param>
        /// <param name="configValue">The value associated with the specified config.</param>
        /// <param name="context">The context that the modified parser will execute in. If the scope of this parser is exited, as in the Action delegate finishes execution, then the modified parser becomes invalid and won't run.</param>
        public static void ApplyContextConfig(this ILogParser parser, ContextConfigs configName, object configValue, Action <ILogParser> context)
        {
            applyContextCounter.Increment(configName.ToString());

            var config = new Dictionary <ContextConfigs, object>
            {
                { configName, configValue }
            };

            parser.ApplyContextConfig(config, context);
        }