Skip to content

Commit

Permalink
add logging exclusion rule from program.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
avrob committed Aug 3, 2024
1 parent 1bf3750 commit d754750
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
4 changes: 2 additions & 2 deletions SAA/S0142/Models/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class ConfigTable : BaseTable

public class BaseTable : ITableEntity
{
public string? PartitionKey { get; set; }
public string? RowKey { get; set; }
public string PartitionKey { get; set; }
public string RowKey { get; set; }
public DateTimeOffset? Timestamp { get; set; }
public ETag ETag { get; set; }
}
Expand Down
12 changes: 6 additions & 6 deletions SAA/S0142/Models/FileList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ namespace S0142.Models
{
internal class FileListJson
{
public string? FileName { get; set; }
public string? RunDate { get; set; }
public string FileName { get; set; }
public string RunDate { get; set; }
}

internal class FileListTable : ITableEntity
{
public string? PartitionKey { get; set; } // Settlement Date
public string? RowKey { get; set; } // Settlement Run Type
public string PartitionKey { get; set; } // Settlement Date
public string RowKey { get; set; } // Settlement Run Type
public DateTimeOffset? Timestamp { get; set; }
public ETag ETag { get; set; }
public string? FileName { get; set; }
public string? RunDate { get; set; }
public string FileName { get; set; }
public string RunDate { get; set; }
}
}
14 changes: 14 additions & 0 deletions SAA/S0142/Program.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;


var host = new HostBuilder()
.ConfigureFunctionsWebApplication()
.ConfigureServices(services => {
services.AddApplicationInsightsTelemetryWorkerService();
services.ConfigureFunctionsApplicationInsights();
})
.ConfigureLogging(logging =>
{
logging.Services.Configure<LoggerFilterOptions>(logOpts =>
{
LoggerFilterRule defaultRule = logOpts.Rules.FirstOrDefault(
rule => rule.ProviderName == "Microsoft.Extensions.Logging.ApplicationInsights.ApplicationInsightsLoggerProvider");
if (defaultRule is not null)
{
logOpts.Rules.Remove(defaultRule);
}
});
})
.Build();

host.Run();
2 changes: 1 addition & 1 deletion SAA/S0142/S0142.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
Expand Down

0 comments on commit d754750

Please sign in to comment.