manigandham / serilog-sinks-googlecloudlogging

Serilog sink that writes events to Google Cloud Logging
MIT License
41 stars 25 forks source link

how I can overwrite ProjectID in appsettings? #64

Closed ksemele closed 2 years ago

ksemele commented 2 years ago

Hello! I want to use different google projects for same service, but I misunderstand how I can make that? I mean, on dev\stage\prod I uses different values for projectID

I thought it can be overwrites as env variable, like that: Serilog__WriteTo__0__Args__projectID="project_2" but it doesn't work :)

Which way is possible?

manigandham commented 2 years ago

The library by default has to be configured in code. If you want to use appsettings.json as a config file then you can follow the instructions in the readme by using the serilog-settings-configuration package.

There's no support for environment variables so if you want to use those then follow the guide for .NET Configuration: https://learn.microsoft.com/en-us/dotnet/core/extensions/configuration and then you can read the settings and set the values in your code.

ksemele commented 2 years ago

Sounds sad :( Thanks for explaining!