-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFunctionsStartup.cs
37 lines (28 loc) · 1.17 KB
/
FunctionsStartup.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using Unstruk.Functions.Common;
[assembly: FunctionsStartup(typeof(PlatformFunctionsStartup))]
namespace Unstruk.Functions.Common
{
public class PlatformFunctionsStartup : FunctionsStartupBase
{
public PlatformFunctionsStartup()
{
}
public override void ConfigureServices(IServiceCollection services)
{
AddConfiguration(services, out string environmentName, out var builder);
this.Factory = new LoggerFactory();
AddApplicationInsights();
this.Logger = Factory.CreateLogger<PlatformFunctionsStartup>();
if (this.Logger == null)
throw new InvalidOperationException("Failed to create logger.");
services.AddSingleton(_ => this.Logger);
services.AddSingleton(_ => this.Configuration);
services.AddSingleton(_ => this.TelemetryClient);
Logger.LogInformation($"Successfully started Azure Functions, environment [{environmentName}].");
}
}
}