當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。