Adding zap controlled by CLI flags (#47)

* Adding zap controlled by CLI flags

* Updating contributing for further logs
This commit is contained in:
Dario Tranchitella
2020-08-07 15:42:07 +02:00
committed by GitHub
parent 272bbf261e
commit ef51e6dee0
3 changed files with 8 additions and 3 deletions
+2
View File
@@ -27,6 +27,8 @@ spec:
- /manager
args:
- --enable-leader-election
- --zap-encoder=console
- --zap-log-level=debug
image: quay.io/clastix/capsule:latest
imagePullPolicy: IfNotPresent
name: manager
+3 -2
View File
@@ -171,9 +171,10 @@ I0803 15:16:02.042022 1 main.go:281] Starting TCP socket on 0.0.0.0:8443
I0803 15:16:02.042364 1 main.go:288] Listening securely on 0.0.0.0:8443
```
Since Capsule is built using _OperatorSDK_, logging is handled by the zap
Since Capsule is built using _OperatorSDK_, logging is handled by the `zap`
module: verbosity increase can be controlled using the CLI flag `--zap-level`
with a value from `1` to `10` or the [basic keywords](https://godoc.org/go.uber.org/zap/zapcore#Level).
with a value from `1` to `10` or the [basic keywords](https://godoc.org/go.uber.org/zap/zapcore#Level)
although is suggested to use the `zap-devel` flag to get also stacktraces.
> CA generation
>
+3 -1
View File
@@ -78,9 +78,11 @@ func main() {
flag.BoolVar(&forceTenantPrefix, "force-tenant-prefix", false, "Enforces the Tenant owner, "+
"during Namespace creation, to name it using the selected Tenant name as prefix, separated by a dash. "+
"This is useful to avoid Namespace name collision in a public CaaS environment.")
opts := zap.Options{}
opts.BindFlags(flag.CommandLine)
flag.Parse()
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
printVersion()
if v {