Azure / iot-plugandplay-models-tools

Tools to manage the device-models repo
MIT License
13 stars 18 forks source link

[spike][cli] Add switch/--verbose parameter as a global param #23

Closed digimaun closed 3 years ago

digimaun commented 3 years ago

To support a convenient way to change logger behavior instead of customizing config file.

rido-min commented 3 years ago

Do you know if setting the Logging verbosity from ENVVARS works? if so we ca de-prioritize this task

digimaun commented 3 years ago

Actually there is, this is the format for the cross platform env var, when you want to change the default loggers log level.

Show all logs

Logging__LogLevel__Default="Trace"

Show no logs

Logging__LogLevel__Default="None"

Show warning or worse logs

Logging__LogLevel__Default="Warning"

Tested all this with the resolverclient cli v0.0.4 and its working great.

Sounds good on deprioritizing this task. I will capture these notes in the readme.

rido-min commented 3 years ago

@digimaun in Windows/Powershell the format seems to be Logging:LogLevel:Default="Trace"

digimaun commented 3 years ago

For sure that works in windows, but : won't work in bash. This format Logging__LogLevel__Default="Trace" should work in bash and Windows/Powershell. For example here is how I was testing earlier in powershell setting the env var in the session,

$env:Logging__LogLevel__Default="Trace"

So we could break out per os environment what the env var syntax should be, or we stick to one format that works across envs.

digimaun commented 3 years ago

Quick reference on this https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-3.1#set-log-level-by-command-line-environment-variables-and-other-configuration