Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature logging verbosity via env in servercmd #34

Conversation

repson
Copy link
Collaborator

@repson repson commented May 1, 2024

An environment variable has been added to configure register verbosity in servercmd.

The RegisterFlags, ConfigureFromEnv and parseVerbosity functions will help us to better organise the code and manage the contents of the VERBOSITY environment variable in the servercmd package.

In addition, new int constants have been added to define the default, maximum and minimum verbosity values.

@repson repson linked an issue May 1, 2024 that may be closed by this pull request
@sevein
Copy link
Member

sevein commented May 2, 2024

I've just realized that we were actually able to parse root flags. For example, try using:

env CCP_V=10 CCP_DEBUG=true go run . server

So my diagnosis was incorrect, my apologies! I missed the part where we call rootConfig.RegisterFlags(fs) from servercmd.

@sevein sevein closed this May 2, 2024
@sevein
Copy link
Member

sevein commented May 2, 2024

If you wanted to validate the verbosity we could try something like this: ccp...dev/issue-9-verbosity-validation. You can push to that branch if you want to make further changes. Validate mutates the configuration attribute. The function return an error in case we want future validation to raise errors where we want to prevent the program from running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem: logging verbosity can't be configured via env in servercmd
2 participants