Пример #1
0
        protected FileLoggerProvider(FileLoggerContext context, IFileLoggerSettings settings)
        {
            _loggers   = new Dictionary <string, FileLogger>();
            _resetTask = Task.CompletedTask;

            Context   = context ?? FileLoggerContext.Default;
            Settings  = settings.Freeze();
            Processor = CreateProcessor(Settings);
        }
Пример #2
0
        public FileLoggerProcessor(FileLoggerContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            Context = context;

            _fallbackFileAppender = new Lazy <PhysicalFileAppender>(() => new PhysicalFileAppender(Environment.CurrentDirectory));

            _logFiles = new Dictionary <ILogFileSettings, LogFileInfo>();

            _completeTaskCompletionSource = new TaskCompletionSource <object>(TaskCreationOptions.RunContinuationsAsynchronously);

            _forcedCompleteTokenSource = new CancellationTokenSource();

            _completeTokenRegistration = context.CompleteToken.Register(Complete, useSynchronizationContext: false);
        }
Пример #3
0
 public FileLoggerProvider(FileLoggerContext context, IOptionsMonitor <FileLoggerOptions> options, string optionsName)
     : this(context, options != null ? options.Get(optionsName ?? Options.DefaultName) : throw new ArgumentNullException(nameof(options)))
 {
     _optionsName         = optionsName ?? Options.DefaultName;
     _settingsChangeToken = options.OnChange(HandleOptionsChanged);
 }
Пример #4
0
 public FileLoggerProvider(FileLoggerContext context, IOptionsMonitor <FileLoggerOptions> options)
     : this(context, options, null)
 {
 }
Пример #5
0
 public FileLoggerProvider(FileLoggerContext context, IOptions <FileLoggerOptions> options)
     : this(context, options != null ? options.Value : throw new ArgumentNullException(nameof(options)))
 {
 }