protected virtual byte[] EncodeCollection(IEnumerable data) { bool flag; string s = LogRowFormatter.FormatCollection(data, this.escapeLineBreaks, out flag); if (!flag) { return(Utf8Csv.Encode(s)); } return(Utf8Csv.EncodeAndEscape(s, this.escapeLineBreaks)); }
public static string FormatCollection(IEnumerable data, out bool needsEscaping) { return(LogRowFormatter.FormatCollection(data, LogRowFormatter.DefaultEscapeLineBreaks, out needsEscaping)); }
public static string FormatCollection(IEnumerable data) { bool flag; return(LogRowFormatter.FormatCollection(data, out flag)); }
protected override void InternalDispose(bool disposing) { if (!this.isDisposeAlreadyCalled && disposing && this.ActivityScope != null) { lock (this.SyncRoot) { if (!this.isDisposeAlreadyCalled) { this.excludeLogEntry |= this.SkipLogging; try { if (this.ActivityScope.ActivityType == ActivityType.Request) { this.FetchLatencyData(); if (!this.excludeLogEntry) { this.PreCommitTasks(); } } if (this.EndActivityContext && this.ActivityScope.Status == ActivityContextStatus.ActivityStarted) { this.ActivityScope.End(); } if (!this.excludeLogEntry) { List <KeyValuePair <string, object> > formattableMetadata = this.ActivityScope.GetFormattableMetadata(); formattableMetadata.RemoveAll(delegate(KeyValuePair <string, object> pair) { Enum @enum = ActivityContext.LookupEnum(pair.Key); return(object.Equals(@enum, RequestDetailsLoggerBase <T> .RequestLoggerConfig.GenericInfoColumn) || object.Equals(@enum, ActivityStandardMetadata.ReturnClientRequestId) || RequestDetailsLoggerBase <T> .enumToIndexMap.ContainsKey(@enum)); }); List <KeyValuePair <string, object> > collection = WorkloadManagementLogger.FormatWlmActivity(this.ActivityScope, false); formattableMetadata.AddRange(collection); foreach (KeyValuePair <Enum, int> keyValuePair in RequestDetailsLoggerBase <T> .enumToIndexMap) { string text = this.Get(keyValuePair.Key); if (object.Equals(RequestDetailsLoggerBase <T> .RequestLoggerConfig.GenericInfoColumn, keyValuePair.Key)) { text += LogRowFormatter.FormatCollection(formattableMetadata); } if (!string.IsNullOrEmpty(text)) { text = RequestDetailsLoggerBase <T> .FormatForCsv(text); this.Row[keyValuePair.Value] = text; } } RequestDetailsLoggerBase <T> .Log.Append(this.Row, -1); this.UploadDataToStreamInsight(); } } finally { if (this.ActivityScope != null && this.EndActivityContext && this.ActivityScope.Status == ActivityContextStatus.ActivityStarted) { this.ActivityScope.End(); } this.isDisposeAlreadyCalled = true; } } } } }