Exemple #1
0
        public static void CreateOrModifyLoggerForDbContext(Type DbContextType,
                                                            ILoggerFactory loggerFactory,
                                                            Action <string> logger,
                                                            Func <string, LogLevel, bool> filter = null)
        {
            bool isNew    = false;
            var  provider = providers.GetOrAdd(DbContextType, t =>
            {
                var p = new EFLogProvider(logger, filter ?? DefaultFilter);
                loggerFactory.AddProvider(p);
                isNew = true;
                return(p);
            }
                                               );

            if (!isNew)
            {
                provider.Configuration = new LoggingConfiguration(logger, filter ?? DefaultFilter);
            }
        }
 public Logger(string categoryName, EFLogProvider provider)
 {
     this.provider     = provider;
     this.categoryName = categoryName;
 }