formatting (#1847)

This commit is contained in:
Cheick Keita
2022-04-26 10:22:35 -07:00
committed by GitHub
parent 8003b1d3e0
commit 5f8e381fcb
55 changed files with 1097 additions and 1915 deletions

View File

@ -1,26 +1,20 @@
// to avoid collision with Task in model.cs
global using Async = System.Threading.Tasks;
global using System;
global using System.Collections.Generic;
global using System.Linq;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Azure.Functions.Worker.Middleware;
global using Async = System.Threading.Tasks;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Middleware;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Microsoft.OneFuzz.Service;
public class Program
{
public class LoggingMiddleware : IFunctionsWorkerMiddleware
{
public async Async.Task Invoke(FunctionContext context, FunctionExecutionDelegate next)
{
public class Program {
public class LoggingMiddleware : IFunctionsWorkerMiddleware {
public async Async.Task Invoke(FunctionContext context, FunctionExecutionDelegate next) {
var log = (ILogTracerInternal?)context.InstanceServices.GetService<ILogTracer>();
if (log is not null)
{
if (log is not null) {
//TODO
//if correlation ID is available in HTTP request
//if correlation ID is available in Queue message
@ -37,14 +31,11 @@ public class Program
}
public static List<ILog> GetLoggers(IServiceConfig config)
{
public static List<ILog> GetLoggers(IServiceConfig config) {
List<ILog> loggers = new List<ILog>();
foreach (var dest in config.LogDestinations)
{
foreach (var dest in config.LogDestinations) {
loggers.Add(
dest switch
{
dest switch {
LogDestination.AppInsights => new AppInsights(config.ApplicationInsightsInstrumentationKey!),
LogDestination.Console => new Console(),
_ => throw new Exception($"Unhandled Log Destination type: {dest}"),
@ -55,12 +46,10 @@ public class Program
}
public static void Main()
{
public static void Main() {
var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults(
builder =>
{
builder => {
builder.UseMiddleware<LoggingMiddleware>();
}
)