diff options
author | José Bollo <jose.bollo@iot.bzh> | 2018-06-19 20:16:28 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2018-06-22 09:48:48 +0200 |
commit | 525e9eaa644ca92fad23adfbb7c3119ae8b57a30 (patch) | |
tree | 41de59627ccc937450daf4da6488efd4f4b2f3c2 /docs/reference-v3/macro-log.md | |
parent | 9e15212d26916f59fae2be6d9e618ae9b75a4f40 (diff) |
Improve documentation of api v3
The documentation is improved to reflect the new version.
Tune the options
Change-Id: I894c3db3bc0c10e89db66a9a51a9ad049bb8c0c4
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'docs/reference-v3/macro-log.md')
-rw-r--r-- | docs/reference-v3/macro-log.md | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/docs/reference-v3/macro-log.md b/docs/reference-v3/macro-log.md new file mode 100644 index 00000000..90d0be45 --- /dev/null +++ b/docs/reference-v3/macro-log.md @@ -0,0 +1,53 @@ +Macro for logging +================= + +The final behaviour of macros can be tuned using 2 defines that must be defined +before including **<afb/afb-binding.h>**. + +| define | action +|---------------------------------------|-------------------- +| AFB_BINDING_PRAGMA_NO_VERBOSE_DATA | show file and line, remove function and text message +| AFB_BINDING_PRAGMA_NO_VERBOSE_DETAILS | show text, remove function, line and file + +## Logging for an api + +The following macros must be used for logging for an **api** of type +**afb_api_t**. + +```C +AFB_API_ERROR(api,fmt,...) +AFB_API_WARNING(api,fmt,...) +AFB_API_NOTICE(api,fmt,...) +AFB_API_INFO(api,fmt,...) +AFB_API_DEBUG(api,fmt,...) +``` + +## Logging for a request + + +The following macros can be used for logging in the context +of a request **req** of type **afb_req_t**: + +```C +AFB_REQ_ERROR(req,fmt,...) +AFB_REQ_WARNING(req,fmt,...) +AFB_REQ_NOTICE(req,fmt,...) +AFB_REQ_INFO(req,fmt,...) +AFB_REQ_DEBUG(req,fmt,...) +``` + +By default, the logging macros add file, line and function +indication. + +## Logging legacy + +The following macros are provided for legacy. + +```C +AFB_ERROR(fmt,...) +AFB_WARNING(fmt,...) +AFB_NOTICE(fmt,...) +AFB_INFO(fmt,...) +AFB_DEBUG(fmt,...) +``` + |