From 30b2a8dd8db0dbc8f7930e8f16bcbdb06bdda8ea Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Fri, 5 Jul 2019 12:13:32 +0200 Subject: [PATCH] feat(log/README): document data param --- @xen-orchestra/log/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/@xen-orchestra/log/README.md b/@xen-orchestra/log/README.md index ab3256256..95431853a 100644 --- a/@xen-orchestra/log/README.md +++ b/@xen-orchestra/log/README.md @@ -24,6 +24,19 @@ log.info('this information is relevant to the user') log.warn('something went wrong but did not prevent current action') log.error('something went wrong') log.fatal('service/app is going down') + +// you can add contextual info +log.debug('new API request', { + method: 'foo', + params: [ 'bar', 'baz' ] + user: 'qux' +}) + +// by convention, errors go into the `error` field +log.error('could not join server', { + error, + server: 'example.org', +}) ``` Then, at application level, configure the logs are handled: