-
Notifications
You must be signed in to change notification settings - Fork 549
feat(logging): Consolidate logging flags #858
Description
Is your feature request related to a problem? Please describe.
We have 10 flags to configure logging:
verbose, enable-console-log, encode-json, enable-file-logging, disable-log-color, log-directory, log-file, max-size, max-backups, max-age
Some use enable-* notation, one uses disable-* notation, some prefix the flag with log-* and some don't have a prefix.
Also enable-file-logging use logging while others use log.
We should ensure flags have consistent naming and descriptions.
Describe the solution you'd like
Suggestions:
-
verbose- stays the same -
enable-console-log- stays the same, or rename tolog-format=console(allowing multiple formats via additional flags) -
enable-file-logging- rename toenable-file-logor tolog-format=file(allowing multiple formats via additional flags) -
encode-json- rename toconsole-log-formatorlog-format=console-jsonvia feat(logging): Renameencode-jsonflag to better convey its purpose #857 -
disable-log-color- rename tocolorwith options ofon,off,auto. Defaultautoto detect if environment supports colors, cloud be done via Bug(logging):NO_COLORenv variable is not respected when console logging is enabled #859 -
log-directory- stays the same -
log-file- stays the same (maybe rename tolog-filename) -
max-size, max-backups, max-age- prefix withlog
Describe alternatives you've considered
Move some of the options (like max-size, max-backups, max-age) to config.hcl, but that's tricky since then how do users will be able to control logging before they generate the config
Logging configuration can be set via the config.yml file but should be removed
Additional context
Related to https://github.com/cloudquery/cloudquery/issues?q=is%3Aopen+is%3Aissue+label%3A%22theme%3A+logging%22.
We could do this in a non breaking way via MarkDeprecated and SetNormalizeFunc functions of the Cobra API