Skip to content

Commit 745109f

Browse files
authored
updating category prefixes (#6590)
1 parent aca1b2c commit 745109f

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/WebJobs.Script/Extensions/ScriptLoggingBuilderExtensions.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Linq;
55
using Microsoft.AspNetCore.Hosting;
6+
using Microsoft.Azure.WebJobs.Script;
67
using Microsoft.Azure.WebJobs.Script.Configuration;
78
using Microsoft.Extensions.Configuration;
89
using Microsoft.Extensions.Hosting;
@@ -11,14 +12,6 @@ namespace Microsoft.Extensions.Logging
1112
{
1213
public static class ScriptLoggingBuilderExtensions
1314
{
14-
internal static readonly string[] AllowedCategoryPrefixes = new[]
15-
{
16-
"Microsoft.Azure.WebJobs",
17-
"Function",
18-
"Worker",
19-
"Host"
20-
};
21-
2215
public static void AddDefaultWebJobsFilters(this ILoggingBuilder builder)
2316
{
2417
builder.SetMinimumLevel(LogLevel.None);
@@ -33,7 +26,7 @@ public static void AddDefaultWebJobsFilters<T>(this ILoggingBuilder builder, Log
3326

3427
private static bool Filter(string category, LogLevel actualLevel, LogLevel minLevel)
3528
{
36-
return actualLevel >= minLevel && AllowedCategoryPrefixes.Where(p => category.StartsWith(p)).Any();
29+
return actualLevel >= minLevel && ScriptConstants.SystemLogCategoryPrefixes.Where(p => category.StartsWith(p)).Any();
3730
}
3831

3932
public static void AddConsoleIfEnabled(this ILoggingBuilder builder, HostBuilderContext context)

src/WebJobs.Script/ScriptConstants.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,5 +162,7 @@ public static class ScriptConstants
162162
public static readonly ImmutableArray<string> AssemblyFileTypes = ImmutableArray.Create(".dll", ".exe");
163163
public static readonly string HostUserAgent = $"azure-functions-host/{ScriptHost.Version}";
164164
public static readonly NuGetVersion ExtensionBundleVersionTwo = new NuGetVersion("2.0.0");
165+
166+
public static readonly ImmutableArray<string> SystemLogCategoryPrefixes = ImmutableArray.Create("Microsoft.Azure.WebJobs.", "Function.", "Worker.", "Host.");
165167
}
166168
}

0 commit comments

Comments
 (0)