Skip to content

Commit 08d7624

Browse files
committed
Writing "function disabled" logs to log stream
1 parent b567159 commit 08d7624

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/WebJobs.Script/Host/ScriptHost.cs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,8 @@ private static FunctionMetadata ParseFunctionMetadata(string functionName, JObje
433433
}
434434

435435
// A function can be disabled at the trigger or function level
436-
if (IsDisabled(functionName, triggerDisabledValue) ||
437-
IsDisabled(functionName, (JValue)configMetadata["disabled"]))
436+
if (IsDisabled(triggerDisabledValue) ||
437+
IsDisabled((JValue)configMetadata["disabled"]))
438438
{
439439
functionMetadata.IsDisabled = true;
440440
}
@@ -492,6 +492,11 @@ private Collection<FunctionDescriptor> ReadFunctions(ScriptHostConfiguration con
492492
continue;
493493
}
494494

495+
if (metadata.IsDisabled)
496+
{
497+
TraceWriter.Info(string.Format("Function '{0}' is disabled", functionName));
498+
}
499+
495500
// determine the primary script
496501
string[] functionFiles = Directory.EnumerateFiles(scriptDir).Where(p => Path.GetFileName(p).ToLowerInvariant() != ScriptConstants.FunctionMetadataFileName).ToArray();
497502
if (functionFiles.Length == 0)
@@ -820,19 +825,6 @@ private void OnFileChanged(object sender, FileSystemEventArgs e)
820825
}
821826
}
822827

823-
private static bool IsDisabled(string functionName, JValue disabledValue)
824-
{
825-
if (disabledValue != null && IsDisabled(disabledValue))
826-
{
827-
// TODO: this needs to be written to the TraceWriter, not
828-
// Console
829-
Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Function '{0}' is disabled", functionName));
830-
return true;
831-
}
832-
833-
return false;
834-
}
835-
836828
private static bool IsDisabled(JToken isDisabledValue)
837829
{
838830
if (isDisabledValue != null)

0 commit comments

Comments
 (0)