Пример #1
0
        /// <summary>
        /// Creates an instance of the <see cref="ConsoleLogger"/> using
        /// the specified <paramref name="options"/> object.
        /// </summary>
        /// <param name="options">
        /// A <see cref="IDictionary{TKey,TValue}"/> object that contains the
        /// options for the logger to be created.
        /// </param>
        /// <returns>
        /// The newly created <see cref="ILogger"/> object.
        /// </returns>
        public ILogger CreateLogger(IDictionary <string, string> options)
        {
            string layout_pattern = ProviderOptions.GetIfExists(options,
                                                                Strings.kLayoutPattern, AbstractLogger.kDefaultLogMessagePattern);
            ConsoleLogger logger = new ConsoleLogger(layout_pattern);

            logger.Configure();
            return(logger);
        }
Пример #2
0
        /// <summary>
        /// Creates an instance of the <see cref="LegacyLogger"/> class using the
        /// specified provider node.
        /// </summary>
        /// <param name="options">
        /// A <see cref="IDictionary{TKey,TValue}"/> object that contains the
        /// options for the logger to be created.
        /// </param>
        /// <returns>
        /// The newly created <see cref="LegacyLogger"/> object.
        /// </returns>
        public ILogger CreateLogger(IDictionary <string, string> options)
        {
            string logger_name = ProviderOptions.GetIfExists(options,
                                                             Strings.kLoggerName, Strings.kDefaultLoggerName);
            string xml_element_name = ProviderOptions.GetIfExists(options,
                                                                  Strings.kLegacyLoggerXmlElementName,
                                                                  Strings.kDefaultLegacyLoggerXmlElementName);

            // Get the xml element that is used to configure the legacy log4net
            // logger.
            XmlElement   element       = settings_.XmlElements[xml_element_name];
            LegacyLogger legacy_logger = new LegacyLogger(element, logger_name);

            legacy_logger.Configure();
            return(legacy_logger);
        }