Skip to content

Commit 56d2014

Browse files
committed
Fixing duplicate compilation logs (#1866)
1 parent 980f1fa commit 56d2014

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/WebJobs.Script/Description/FunctionInvokerBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,8 @@ protected virtual void OnScriptFileChanged(FileSystemEventArgs e)
138138
{
139139
}
140140

141-
protected void TraceOnPrimaryHost(string message, TraceLevel level, string source = null, Exception exception = null)
141+
protected internal void TraceOnPrimaryHost(string message, TraceLevel level, string source = null, Exception exception = null)
142142
{
143-
TraceWriter.Trace(message, level, PrimaryHostTraceProperties);
144143
var traceEvent = new TraceEvent(level, message, source, exception);
145144
foreach (var item in PrimaryHostTraceProperties)
146145
{

test/WebJobs.Script.Tests/Description/FunctionInvokerBaseTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ public FunctionInvokerBaseTests()
4949
funcDescriptor.Name = metadata.Name;
5050
}
5151

52+
[Fact]
53+
public void TraceOnPrimaryHost_WritesExpectedLogs()
54+
{
55+
_traceWriter.Traces.Clear();
56+
57+
_invoker.TraceOnPrimaryHost("Test message", TraceLevel.Info, "TestSource");
58+
59+
Assert.Equal(1, _traceWriter.Traces.Count);
60+
var trace = _traceWriter.Traces[0];
61+
Assert.Equal("Test message", trace.Message);
62+
Assert.Equal(TraceLevel.Info, trace.Level);
63+
Assert.Equal("TestSource", trace.Source);
64+
}
65+
5266
[Fact]
5367
public void LogInvocationMetrics_EmitsExpectedEvents()
5468
{

0 commit comments

Comments
 (0)