The Wayback Machine - https://web.archive.org/web/20210121031920/https://github.com/crossplane/crossplane/issues/1977
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

Separate log-level and structured/unstructured cmd options #1977

Open
kasey opened this issue Nov 19, 2020 · 3 comments
Open

Separate log-level and structured/unstructured cmd options #1977

kasey opened this issue Nov 19, 2020 · 3 comments

Comments

@kasey
Copy link
Member

@kasey kasey commented Nov 19, 2020

What problem are you facing?

Setting the --debug flag currently also changes the output formatting of our logs to semi-structured. It can sometimes be helpful to switch to a debug log level in production, or use structured logs in development.

How could Crossplane help solve your problem?

Remove the --debug flag and add 2 new flags --log-level=(info|debug) and --output=(json|text)\-o. My thinking in naming the output flag is to mirror kubectl but I'm not convinced that's the right move since this only pertains to logs (although we don't have any other output?), maybe --log-format would be more clear.

@negz
Copy link
Member

@negz negz commented Nov 19, 2020

Remove the --debug flag and add 2 new flags

I like the idea of decoupling output format from verbosity but I'd prefer to avoid removing the debug flag as that could be considered a breaking/potentially disruptive change. What do you think about instead adding a new flag ala --output or --log-format? The idea being that if the --log-format flag was omitted Crossplane would behave exactly as it does today, but if the flag were supplied it would be possible to override today's behaviour (i.e. to use fully structured debug logging, or to use human readable info logging, etc).

@kasey
Copy link
Member Author

@kasey kasey commented Nov 19, 2020

I should have mentioned defaults. To match current behavior I had been thinking the default value of --log-format would be json and the default format of --log-level would be info. We could keep --debug and just define it as a shortcut/legacy (maybe set it for deprecation and warn?) for setting --log-format=text and --log-level=debug.

@negz
Copy link
Member

@negz negz commented Nov 20, 2020

We could keep --debug and just define it as a shortcut/legacy (maybe set it for deprecation and warn?) for setting --log-format=text and --log-level=debug.

I'm not seeing why we'd need to deprecate or replace it - it doesn't feel broken to me. That said, I don't feel particularly strongly about this except that I don't want folks who expect to be able to run crossplane --debug to experience issues due to that flag being removed.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.