Beispiel #1
0
        internal FileLogger(string name, FileLoggerProcessor loggerProcessor)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            _name           = name;
            _queueProcessor = loggerProcessor;
        }
Beispiel #2
0
        /// <summary>
        /// Creates an instance of <see cref="FileLoggerProvider"/>.
        /// </summary>
        /// <param name="options">The options to create <see cref="FileLogger"/> instances with.</param>
        public FileLoggerProvider(IOptionsMonitor <FileLoggerOptions> options)
        {
            _options = options;
            _loggers = new ConcurrentDictionary <string, FileLogger>();

            ReloadLoggerOptions(options.CurrentValue);
            _optionsReloadToken = _options.OnChange(ReloadLoggerOptions);

            _messageQueue           = new FileLoggerProcessor();
            _messageQueue.OutStream = new StreamWriter(options.CurrentValue.LogFile, false);
        }