Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LoggerFactory"/> class with the given <paramref name="logger"/>.
        /// </summary>
        /// <param name="logger">The logger to use.</param>
        public LoggerFactory([NotNull] IEventSourceLogger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            this.logger = logger;
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Specifies an instance of <see cref="IEventSourceLogger"/> to use.
        /// </summary>
        /// <param name="logger">The logger to use.</param>
        public void WithLogger([NotNull] IEventSourceLogger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            this.loggerFactory = new LoggerFactory(logger);
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="Logger" /> class with the given <paramref name="loggerName" />.
        /// </summary>
        /// <param name="eventSourceLogger">The <see cref="IEventSourceLogger"/> to log to.</param>
        /// <param name="loggerName">The name of the <see cref="Logger" /> to create.</param>
        public Logger([NotNull] IEventSourceLogger eventSourceLogger, [CanBeNull] string loggerName)
        {
            if (eventSourceLogger == null)
            {
                throw new ArgumentNullException(nameof(eventSourceLogger));
            }

            this.eventSourceLogger = eventSourceLogger;
            this.loggerName        = string.IsNullOrWhiteSpace(loggerName) ? DefaultLoggerName : loggerName;
        }