Ejemplo n.º 1
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;
    }