Requirements
Flagd currently prints structured logs in json format, when running flagd in the console this can cause the logs to be difficult to read.
the zap logger zap.Config struct contains the field Encoding which when set to console instead of json updates the logging structure as follows:
json
{"level":"info","ts":1671548378.306176,"caller":"runtime/runtime.go:84","msg":"configuration change (write) for flagKey headerColor (config/samples/example_flags.json)","component":"runtime"}
{"level":"info","ts":1671548378.3061912,"caller":"runtime/runtime.go:84","msg":"configuration change (write) for flagKey myBoolFlag (config/samples/example_flags.json)","component":"runtime"}
{"level":"info","ts":1671548378.306196,"caller":"runtime/runtime.go:84","msg":"configuration change (write) for flagKey myStringFlag (config/samples/example_flags.json)","component":"runtime"}
{"level":"info","ts":1671548378.306199,"caller":"runtime/runtime.go:84","msg":"configuration change (write) for flagKey myFloatFlag (config/samples/example_flags.json)","component":"runtime"}
{"level":"info","ts":1671548378.3062022,"caller":"runtime/runtime.go:84","msg":"configuration change (write) for flagKey myIntFlag (config/samples/example_flags.json)","component":"runtime"}
console
1.671549411055416e+09 info runtime/runtime.go:84 configuration change (write) for flagKey myFloatFlag (config/samples/example_flags.json) {"component": "runtime"}
1.6715494110554419e+09 info runtime/runtime.go:84 configuration change (write) for flagKey myIntFlag (config/samples/example_flags.json) {"component": "runtime"}
1.671549411055447e+09 info runtime/runtime.go:84 configuration change (write) for flagKey myObjectFlag (config/samples/example_flags.json) {"component": "runtime"}
1.671549411055451e+09 info runtime/runtime.go:84 configuration change (write) for flagKey isColorYellow (config/samples/example_flags.json) {"component": "runtime"}
This behaviour should be controlled via a viper flag, e.g. --log-encoding=console with a json default e.g. --log-encoding=json with a console default
Requirements
Flagd currently prints structured logs in json format, when running flagd in the console this can cause the logs to be difficult to read.
the zap logger
zap.Configstruct contains the fieldEncodingwhich when set toconsoleinstead ofjsonupdates the logging structure as follows:jsonconsoleThis behaviour should be controlled via a viper flag,
e.g.e.g.--log-encoding=consolewith ajsondefault--log-encoding=jsonwith aconsoledefault