FileLoggerExtensions.cs 671 B

1234567891011121314151617181920212223
  1. using Microsoft.Extensions.Configuration;
  2. using Microsoft.Extensions.Logging;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. namespace CZFW.Logger
  7. {
  8. public static class FileLoggerExtensions
  9. {
  10. public static ILoggerFactory AddFile(this ILoggerFactory factory, IConfiguration configuration)
  11. {
  12. return AddFile(factory, new FileLoggerSettings(configuration));
  13. }
  14. public static ILoggerFactory AddFile(this ILoggerFactory factory, FileLoggerSettings fileLoggerSettings)
  15. {
  16. factory.AddProvider(new FileLoggerProvider(fileLoggerSettings));
  17. return factory;
  18. }
  19. }
  20. }