public static LogEntryMessage Log(this LogEntry entry, int level, string message, string stacktrace = null, string traceId = null) { var msg = new LogEntryMessage { Level = level, Message = message, Stacktrace = stacktrace, TraceId = traceId }; entry.Messages.Add(msg); return(msg); }
public static LogEntryMessage Attach(this LogEntryMessage message, string name, string contentType, string contentEncoding, byte[] data, ILookup <string, object> headers) { var attachment = new LogEntryAttachment { Id = Guid.NewGuid().ToString(), Name = name, ContentType = contentType, ContentEncoding = contentEncoding, Headers = headers?.SelectMany(g => g.Select(v => new KeyValuePair <string, object>(g.Key, v))).ToArray() ?? new KeyValuePair <string, object> [0], Data = data }; message.Attachments.Add(attachment); return(message); }