Beispiel #1
0
 public static void InitHub(MongoLoggerSetting setting)
 {
     if (string.IsNullOrWhiteSpace(setting.ConnString))
     {
         throw new ArgumentNullException("MongoDB链接字符串不能为空");
     }
     if (string.IsNullOrWhiteSpace(setting.Database))
     {
         throw new ArgumentNullException("database不能为空");
     }
     if (string.IsNullOrWhiteSpace(setting.Collection))
     {
         throw new ArgumentNullException("collection不能为空");
     }
     _database   = setting.Database;
     _collection = setting.Collection;
     _connString = setting.ConnString;
 }
Beispiel #2
0
 public static ILoggerFactory AddLogging2MongoExtension(this ILoggerFactory factory, MongoLoggerSetting setting)
 {
     MongoLogHub.InitHub(setting);
     factory.AddProvider(new MongoLoggerProvider(setting.LogLevel));
     return(factory);
 }