当前位置: 首页>>代码示例>>C#>>正文


C# LoggingEvent.Select方法代码示例

本文整理汇总了C#中log4net.Core.LoggingEvent.Select方法的典型用法代码示例。如果您正苦于以下问题:C# LoggingEvent.Select方法的具体用法?C# LoggingEvent.Select怎么用?C# LoggingEvent.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在log4net.Core.LoggingEvent的用法示例。


在下文中一共展示了LoggingEvent.Select方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendBuffer

 /// <inheritdoc />
 protected override void SendBuffer(LoggingEvent[] events)
 {
     if ((events == null) || (serviceChannelFactory == null) || 
         string.IsNullOrEmpty(ApplicationName))
         return;
     using (var tsc = new TransactionScope(TransactionScopeOption.Suppress))
     {
         var currentService = GetLogService();
         var serviceEvents = events.Select(e => Map(e)).ToArray();
         currentService.Handle(serviceEvents);
     }
 }
开发者ID:Aaronaught,项目名称:Convolved.Logging,代码行数:13,代码来源:ServiceAppender.cs

示例2: Append

        protected override void Append(LoggingEvent[] loggingEvents)
        {
            if (loggingEvents == null || loggingEvents.Length < 1)
                return;

            loggingEvents = (from e in loggingEvents where e != null select e).ToArray();
            if (loggingEvents == null || loggingEvents.Length < 1)
                return;

            MongoCollection collection = MongoDbRef.Instance.GetCollection(this);
            BsonDocument[] docs = loggingEvents.Select(BuildBsonDocument).ToArray();
            collection.InsertBatch(docs, WriteConcern.Unacknowledged);
        }
开发者ID:ronin1,项目名称:log4mongo-net,代码行数:13,代码来源:MongoDBAppender.cs

示例3: Append

 protected override void Append(LoggingEvent[] loggingEvents)
 {
     var collection = GetCollection(CollectionName);
     IMongoCollection<BsonDocument> dualCollection = null;
     if (!string.IsNullOrWhiteSpace(DualCollectionName))
     {
         dualCollection = GetCollection(DualCollectionName);
     }
     Task.Run(() =>
     {
         collection.InsertManyAsync(loggingEvents.Select(BuildBsonDocument));
         dualCollection?.InsertManyAsync(
             loggingEvents.Where(log => log.Level >= DualCollectionLevelThreshold).Select(BuildBsonDocument));
     });
 }
开发者ID:carmbrester,项目名称:Charm.Logging,代码行数:15,代码来源:MongoDBDualAppenderWithEx.cs

示例4: Append

 protected override void Append(LoggingEvent[] loggingEvents)
 {
     var collection = GetCollection();
     collection.InsertBatch(loggingEvents.Select(BuildBsonDocument));
 }
开发者ID:rdbenoit,项目名称:log4mongo-net,代码行数:5,代码来源:MongoDBAppender.cs

示例5: Append

 protected override void Append(LoggingEvent[] loggingEvents)
 {
     var collection = GetCollection();
     Task.Run(() => collection.InsertManyAsync(loggingEvents.Select(BuildBsonDocument)));
 }
开发者ID:carmbrester,项目名称:Charm.Logging,代码行数:5,代码来源:RollingMongoDBAppender.cs

示例6: Append

 protected override void Append(LoggingEvent[] loggingEvents)
 {
     var collection = GetCollection();
     collection.InsertManyAsync(loggingEvents.Select(BuildBsonDocument));
     CreateExpiryAfterIndex(collection);
 }
开发者ID:seanfitzg,项目名称:log4mongo-net,代码行数:6,代码来源:MongoDBAppender.cs

示例7: Append

 /// <summary>
 /// 将loggingEvent对象转换成Bson对象存入Mongo
 /// </summary>
 /// <param name="loggingEvent">
 /// loggingEvent对象
 /// </param>
 protected override void Append(LoggingEvent[] loggingEvents)
 {
     MongoServer mongo = null;
     try
     {
         mongo = GetMongo();
         mongo.Connect();
         MongoDatabase database = mongo.GetDatabase(DatabaseName ?? "logsDotNet");
         MongoCollection collection = database.GetCollection(CollectionName);
         collection.InsertBatch(loggingEvents.Select(BuildBsonDocument));
     }
     catch (Exception ex)
     {
         WriteLog(string.Format("写入MonogoDb异常,ex={0}", ex.ToString()));
     }
     finally
     {
         if (mongo != null)
         {
             mongo.Disconnect();
         }
     }
 }
开发者ID:rainchan,项目名称:weitao,代码行数:29,代码来源:MongoDBAppender.cs

示例8: Append

        protected override void Append(LoggingEvent[] loggingEvents)
        {
            var mongoDbHelper = new MongoDbHelper();

            // get connectionString from config file
            var connectionString = mongoDbHelper.GetConnectionString(ConnectionStringName, ConnectionString);

            // get database
            var db = mongoDbHelper.GetDatabase(connectionString);

            // get collection
            var collection = mongoDbHelper.GetCollection(
                db,
                CappedCollection != null && Convert.ToBoolean(CappedCollection),
                CollectionName,
                CappedCollectionSize != null ? long.Parse(CappedCollectionSize) : MongoDbHelper.DefaultCappedCollectionSize,
                MaxNumberOfDocuments != null ? long.Parse(MaxNumberOfDocuments) : MongoDbHelper.DefaultCappedCollectionMaxDocuments);

            // build Bson documents
            var bsonDocuments = loggingEvents.Select(loggingEvent => mongoDbHelper.BuildBsonDocument(loggingEvent, _fields)).ToList();

            // insert docs in db
            mongoDbHelper.InsertDocumentsInCollection(bsonDocuments, collection);
        }
开发者ID:AzharIqbal84,项目名称:ForwardMongoLogger,代码行数:24,代码来源:MongoDbAppender.cs


注:本文中的log4net.Core.LoggingEvent.Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。