Skip to content

Commit

Permalink
Fixing duplicate compilation logs (Azure#1866)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathewc committed Sep 6, 2017
1 parent 980f1fa commit 56d2014
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/WebJobs.Script/Description/FunctionInvokerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,8 @@ protected virtual void OnScriptFileChanged(FileSystemEventArgs e)
{
}

protected void TraceOnPrimaryHost(string message, TraceLevel level, string source = null, Exception exception = null)
protected internal void TraceOnPrimaryHost(string message, TraceLevel level, string source = null, Exception exception = null)
{
TraceWriter.Trace(message, level, PrimaryHostTraceProperties);
var traceEvent = new TraceEvent(level, message, source, exception);
foreach (var item in PrimaryHostTraceProperties)
{
Expand Down
14 changes: 14 additions & 0 deletions test/WebJobs.Script.Tests/Description/FunctionInvokerBaseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ public FunctionInvokerBaseTests()
funcDescriptor.Name = metadata.Name;
}

[Fact]
public void TraceOnPrimaryHost_WritesExpectedLogs()
{
_traceWriter.Traces.Clear();

_invoker.TraceOnPrimaryHost("Test message", TraceLevel.Info, "TestSource");

Assert.Equal(1, _traceWriter.Traces.Count);
var trace = _traceWriter.Traces[0];
Assert.Equal("Test message", trace.Message);
Assert.Equal(TraceLevel.Info, trace.Level);
Assert.Equal("TestSource", trace.Source);
}

[Fact]
public void LogInvocationMetrics_EmitsExpectedEvents()
{
Expand Down

0 comments on commit 56d2014

Please sign in to comment.