Skip to content

Commit 0da5d62

Browse files
committed
log record example
1 parent 8403a6f commit 0da5d62

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/dev/logging.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ func (r *ReconcileMemcached) Reconcile(request reconcile.Request) (reconcile.Res
8383
}
8484
```
8585

86+
Log records will look like the following (from `reqLogger.Error()` above):
87+
88+
```
89+
2018-11-08T00:00:25.700Z ERROR operator-sdk.controller_memcached pkg/controller/memcached/memcached_controller.go:118 failed to create new Deployment {"Request.Namespace", "memcached", "Request.Name", "memcached-operator", "Deployment.Namespace", "memcached", "Deployment.Name", "memcached-operator"}
90+
```
91+
8692
## Non-default logging
8793

8894
If you do not want to use `logr` as your logging tool, you can remove `logr`-specific statements without issue from your operator's code, including the `logr` [setup code][code_set_logger] in `cmd/manager/main.go`, and add your own. Note that removing `logr` setup code will prevent `controller-runtime` from logging.

0 commit comments

Comments
 (0)