protected FileLoggerProvider(FileLoggerContext context, IFileLoggerSettings settings)
        {
            _loggers   = new Dictionary <string, FileLogger>();
            _resetTask = Task.CompletedTask;

            Context   = context ?? FileLoggerContext.Default;
            Settings  = settings.Freeze();
            Processor = CreateProcessor(Settings);
        }
Example #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);
        }
 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);
 }
 public FileLoggerProvider(FileLoggerContext context, IOptionsMonitor <FileLoggerOptions> options)
     : this(context, options, null)
 {
 }
 public FileLoggerProvider(FileLoggerContext context, IOptions <FileLoggerOptions> options)
     : this(context, options != null ? options.Value : throw new ArgumentNullException(nameof(options)))
 {
 }