Ejemplo n.º 1
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(IOptions <FileLoggerOptions> options)
        {
            Options = options.Value;

            if (!Directory.Exists(Options.FilePath))
            {
                Directory.CreateDirectory(Options.FilePath);
            }
        }
Ejemplo n.º 2
0
 public FileLogger(string catalogName, Func <string, LogLevel, bool> filter, FileLoggerOptions options)
 {
     if (options == null)
     {
         throw new ArgumentNullException("FileLoggerOptions");
     }
     this.catalogName = catalogName;
     this.filter      = filter;
     this.options     = options;
     EnsurePath();
     GenerateFilePath();
 }
Ejemplo n.º 3
0
 public FileLoggerProvider(Func <string, LogLevel, bool> filter, IOptionsMonitor <FileLoggerOptions> options)
 {
     if (options == null)
     {
         this.options = new FileLoggerOptions();
     }
     else
     {
         this.options       = options.CurrentValue;
         _reloadChangeToken = options.OnChange(Reload);
     }
     this.filter = filter;
 }
Ejemplo n.º 4
0
 public void Reload(FileLoggerOptions options)
 {
     this.options = options;
 }