fides icon indicating copy to clipboard operation
fides copied to clipboard

Make cli logging/output more robust

Open allisonking opened this issue 2 years ago • 2 comments

Is your feature request related to a specific problem?

We currently have echo_red and echo_green as ways to show status for our CLI commands. This often isn't robust enough, for instance in this PR

Describe the solution you'd like

CLI logging/output should allow for both color and types of logging (i.e. error, warning, etc.) Could be similar to logging libs, i.e. [timestamp] WARNING, [timestamp] ERROR etc.

Describe alternatives you've considered, if any

Do nothing and stick with just red and green.

Additional context

https://github.com/ethyca/fides/pull/586

allisonking avatar May 05 '22 20:05 allisonking

It's worth noting that currently all CLI output will be exposed to the user via stdout. We can continue this pattern, and simply implement a dedicated formatting library with a nicer API than echo_[red|yellow|green]() (maybe: success(), warn(), and failure()?). This would be a developer experience improvement above anything else, as it would become dead simple to know how to create output, and where the code lives. FWIW, we can/should consider colorblind users when selecting our colors, either by default or as a config option like:

[user]
colorblind_mode = true

Separately, we can implement CLI logging in addition to output conveniences. This would be a much larger change, as we'd have to create a logger and write the log output to a file since it wouldn't make sense to print log entries to stdout.

PSalant726 avatar May 05 '22 21:05 PSalant726

May be related to https://github.com/ethyca/fides/issues/490 since exceptions will also want to use whatever we end up doing here to output/log

allisonking avatar May 06 '22 17:05 allisonking