當前位置: 首頁>>代碼示例>>C#>>正文


C# LoggingEvent.MakePartitionKey方法代碼示例

本文整理匯總了C#中log4net.Core.LoggingEvent.MakePartitionKey方法的典型用法代碼示例。如果您正苦於以下問題:C# LoggingEvent.MakePartitionKey方法的具體用法?C# LoggingEvent.MakePartitionKey怎麽用?C# LoggingEvent.MakePartitionKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在log4net.Core.LoggingEvent的用法示例。


在下文中一共展示了LoggingEvent.MakePartitionKey方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AzureLoggingEventEntity

        public AzureLoggingEventEntity(LoggingEvent e, PartitionKeyTypeEnum partitionKeyType)
        {
            Domain = e.Domain;
            Identity = e.Identity;
            Level = e.Level.ToString();
            var sb = new StringBuilder(e.Properties.Count);
            foreach (DictionaryEntry entry in e.Properties)
            {
                sb.AppendFormat("{0}:{1}", entry.Key, entry.Value);
                sb.AppendLine();
            }
            Properties = sb.ToString();
            Message = e.RenderedMessage + Environment.NewLine + e.GetExceptionString();
            ThreadName = e.ThreadName;
            EventTimeStamp = e.TimeStamp;
            UserName = e.UserName;
            Location = e.LocationInformation.FullInfo;
            ClassName = e.LocationInformation.ClassName;
            FileName = e.LocationInformation.FileName;
            LineNumber = e.LocationInformation.LineNumber;
            MethodName = e.LocationInformation.MethodName;
            StackFrames = e.LocationInformation.StackFrames;

            if (e.ExceptionObject != null)
            {
                Exception = e.ExceptionObject.ToString();
            }

            PartitionKey = e.MakePartitionKey(partitionKeyType);
            RowKey = e.MakeRowKey();
        }
開發者ID:Thumann,項目名稱:log4net.Azure,代碼行數:31,代碼來源:AzureLoggingEventEntity.cs

示例2: AzureDynamicLoggingEventEntity

        public AzureDynamicLoggingEventEntity(LoggingEvent e, PartitionKeyTypeEnum partitionKeyType)
        {
            this["Domain"] = e.Domain;
            this["Identity"] = e.Identity;
            this["Level"] = e.Level.ToString();
            this["LoggerName"] = e.LoggerName;
            this["Message"] = e.RenderedMessage + Environment.NewLine + e.GetExceptionString();
            this["EventTimeStamp"] = e.TimeStamp;
            this["ThreadName"] = e.ThreadName;
            this["UserName"] = e.UserName;
            this["Location"] = e.LocationInformation.FullInfo;

            if (e.ExceptionObject != null)
            {
                this["Exception"] = e.ExceptionObject.ToString();
            }
            
            foreach (DictionaryEntry entry in e.Properties)
            {
                var key = entry.Key.ToString()
                    .Replace(":", "_")
                    .Replace("@", "_")
                    .Replace(".", "_");
                this[key] = entry.Value;
            }

            Timestamp = e.TimeStamp;
            PartitionKey = e.MakePartitionKey(partitionKeyType);
            RowKey = e.MakeRowKey();
        }
開發者ID:Thumann,項目名稱:log4net.Azure,代碼行數:30,代碼來源:AzureDynamicLoggingEventEntity.cs

示例3: AzureLayoutLoggingEventEntity

        public AzureLayoutLoggingEventEntity(LoggingEvent e, PartitionKeyTypeEnum partitionKeyType, ILayout layout)
        {
            Level = e.Level.ToString();
            Message = e.RenderedMessage + Environment.NewLine + e.GetExceptionString();
            ThreadName = e.ThreadName;
            EventTimeStamp = e.TimeStamp;
            using (var w = new StringWriter())
            {
                layout.Format(w, e);
                Message = w.ToString();
            }

            PartitionKey = e.MakePartitionKey(partitionKeyType);
            RowKey = e.MakeRowKey();
        }
開發者ID:Thumann,項目名稱:log4net.Azure,代碼行數:15,代碼來源:AzureLayoutLoggingEventEntity.cs


注:本文中的log4net.Core.LoggingEvent.MakePartitionKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。