Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with error and critical events #90

Merged
merged 1 commit into from
May 17, 2017
Merged
Changes from all commits
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
25 changes: 12 additions & 13 deletions src/DurableTask.Core/Tracing/DefaultEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ public class DefaultEventSource : EventSource
const int ErrorEventId = 5;
const int CriticalEventId = 6;

public class Keywords
public static class Keywords
{
public const EventKeywords TraceEventKeyword = (EventKeywords)(1);
public const EventKeywords DebugEventKeyword = (EventKeywords)(1 << 1);
public const EventKeywords Diagnostics = (EventKeywords)1L;
}

public static readonly DefaultEventSource Log = new DefaultEventSource();
Expand All @@ -48,9 +47,9 @@ public class Keywords
}
}

public bool IsTraceEnabled => this.IsEnabled(EventLevel.Verbose, Keywords.TraceEventKeyword);
public bool IsTraceEnabled => this.IsEnabled(EventLevel.Verbose, Keywords.Diagnostics);

public bool IsDebugEnabled => this.IsEnabled(EventLevel.Verbose, Keywords.DebugEventKeyword);
public bool IsDebugEnabled => this.IsEnabled(EventLevel.Verbose, Keywords.Diagnostics);

public bool IsInfoEnabled => this.IsEnabled(EventLevel.Informational, EventKeywords.None);

Expand Down Expand Up @@ -95,7 +94,7 @@ public void Trace(string source, string instanceId, string executionId, string s
public void Trace(string source, string instanceId, string executionId, string sessionId, string message, Exception exception) =>
this.Trace(source, instanceId, executionId, sessionId, message, exception?.ToString() ?? string.Empty);

[Event(TraceEventId, Level = EventLevel.Verbose, Keywords = Keywords.TraceEventKeyword)]
[Event(TraceEventId, Level = EventLevel.Verbose, Keywords = Keywords.Diagnostics)]
public void Trace(string source, string instanceId, string executionId, string sessionId, string message, string info)
{
if (this.IsTraceEnabled)
Expand All @@ -112,7 +111,7 @@ public void Debug(string source, string instanceId, string executionId, string s
public void Debug(string source, string instanceId, string executionId, string sessionId, string message, Exception exception) =>
this.Debug(source, instanceId, executionId, sessionId, message, exception?.ToString() ?? string.Empty);

[Event(DebugEventId, Level = EventLevel.Verbose, Keywords = Keywords.DebugEventKeyword)]
[Event(DebugEventId, Level = EventLevel.Verbose, Keywords = Keywords.Diagnostics)]
public void Debug(string source, string instanceId, string executionId, string sessionId, string message, string info)
{
if (this.IsDebugEnabled)
Expand All @@ -129,7 +128,7 @@ public void Info(string source, string instanceId, string executionId, string se
public void Info(string source, string instanceId, string executionId, string sessionId, string message, Exception exception) =>
this.Info(source, instanceId, executionId, sessionId, message, exception?.ToString() ?? string.Empty);

[Event(InfoEventId, Level = EventLevel.Informational)]
[Event(InfoEventId, Level = EventLevel.Informational, Keywords = EventKeywords.None)]
public void Info(string source, string instanceId, string executionId, string sessionId, string message, string info)
{
if (this.IsInfoEnabled)
Expand All @@ -146,7 +145,7 @@ public void Warning(string source, string instanceId, string executionId, string
public void Warning(string source, string instanceId, string executionId, string sessionId, string message, Exception exception) =>
this.Warning(source, instanceId, executionId, sessionId, message, exception?.ToString() ?? string.Empty);

[Event(WarningEventId, Level = EventLevel.Warning)]
[Event(WarningEventId, Level = EventLevel.Warning, Keywords = EventKeywords.None)]
public void Warning(string source, string instanceId, string executionId, string sessionId, string message, string exception)
{
if (this.IsWarningEnabled)
Expand All @@ -163,12 +162,12 @@ public void Error(string source, string instanceId, string executionId, string s
public void Error(string source, string instanceId, string executionId, string sessionId, string message, Exception exception) =>
this.Error(source, instanceId, executionId, sessionId, message, exception?.ToString() ?? string.Empty);

[Event(ErrorEventId, Level = EventLevel.Error)]
[Event(ErrorEventId, Level = EventLevel.Error, Keywords = EventKeywords.None)]
public void Error(string source, string instanceId, string executionId, string sessionId, string message, string exception)
{
if (this.IsErrorEnabled)
{
this.WriteEventInternal(ErrorEventId, instanceId, executionId, sessionId, source, message, exception);
this.WriteEventInternal(ErrorEventId, source, instanceId, executionId, sessionId, message, exception);
}
}

Expand All @@ -180,12 +179,12 @@ public void Critical(string source, string instanceId, string executionId, strin
public void Critical(string source, string instanceId, string executionId, string sessionId, string message, Exception exception) =>
this.Critical(source, instanceId, executionId, sessionId, message, exception?.ToString() ?? string.Empty);

[Event(CriticalEventId, Level = EventLevel.Critical)]
[Event(CriticalEventId, Level = EventLevel.Critical, Keywords = EventKeywords.None)]
public void Critical(string source, string instanceId, string executionId, string sessionId, string message, string exception)
{
if (this.IsCriticalEnabled)
{
this.WriteEventInternal(CriticalEventId, instanceId, executionId, sessionId, source, message, exception);
this.WriteEventInternal(CriticalEventId, source, instanceId, executionId, sessionId, message, exception);
}
}

Expand Down