Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Exceptionless;
using Exceptionless.Logging;
using Serilog.Core;
Expand Down Expand Up @@ -36,6 +37,24 @@ internal static string GetSource(this LogEvent log) {
return null;
}

internal static string[] GetTags(this LogEvent log)
{
if (log.Properties.TryGetValue("Tags", out LogEventPropertyValue value))
{
var propertyCollection = value.FlattenProperties() as List<object>;
if (propertyCollection == null) return Array.Empty<string>();

List<string> tags = new List<string>();
foreach (var item in propertyCollection)
{
tags.Add(item.ToString());
}

return tags.ToArray();
}
return Array.Empty<string>();
}

internal static LogLevel GetLevel(this LogEventLevel log)
{
switch (log)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void Emit(LogEvent logEvent) {
if (logEvent.Level.GetLevel() < minLogLevel)
return;

var builder = _client.CreateFromLogEvent(logEvent).AddTags(_defaultTags);
var builder = _client.CreateFromLogEvent(logEvent).AddTags(_defaultTags).AddTags(logEvent.GetTags());

if (_includeProperties) {
foreach (var prop in logEvent.Properties)
Expand Down