Created
March 30, 2020 13:55
-
-
Save brianhdk/5c16c0ab7f0a0b8f23bbf796e955ed86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Startup : IWebJobsStartup | |
| { | |
| public void Configure(IWebJobsBuilder builder) | |
| { | |
| string environment = Environment.GetEnvironmentVariable("AZURE_FUNCTIONS_ENVIRONMENT"); | |
| if (!string.Equals(environment, "Development", StringComparison.OrdinalIgnoreCase)) | |
| { | |
| builder.Services.AddLogging(loggingBuilder => loggingBuilder | |
| .AddSerilog(new LoggerConfiguration() | |
| .WriteTo | |
| .Elasticsearch(new ElasticsearchSinkOptions(ElasticClientFactory.Url) | |
| { | |
| AutoRegisterTemplate = true, | |
| AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv7, | |
| MinimumLogEventLevel = LogEventLevel.Information, | |
| ModifyConnectionSettings = connection => | |
| { | |
| connection.BasicAuthentication(ElasticClientFactory.Username, ElasticClientFactory.Password); | |
| return connection; | |
| } | |
| }) | |
| .CreateLogger())); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment