From 53099a282ae1793bf5f3407c9d60334bfd5e0f23 Mon Sep 17 00:00:00 2001 From: Fabi Date: Tue, 27 Feb 2024 09:39:21 +0100 Subject: [PATCH] docs: log module for actions (#7448) * docs: log module for actions * Update modules.md --------- Co-authored-by: Livio Spring --- docs/docs/apis/actions/modules.md | 36 ++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/docs/docs/apis/actions/modules.md b/docs/docs/apis/actions/modules.md index 6624ff9de..9b87b5190 100644 --- a/docs/docs/apis/actions/modules.md +++ b/docs/docs/apis/actions/modules.md @@ -52,6 +52,40 @@ The object has the following fields and methods: - `text()` *string* Returns the body +## Log + +The log module provides you with the functionality to log to stdout. + +### Import + +```js + let logger = require("zitadel/log") +``` + +### `log()`, `warn()`, `error()` function + +The logger offers three distinct log levels (info, warn, and error) to effectively communicate messages based on their severity, enhancing debugging and troubleshooting efficiency. +Use the function that reflects your log level. + +- log() +- warn() +- error() + +### Example + +```js +logger.info("This is an info log.") + +logger.warn("This is a warn log.") + +logger.error("This is an error log.") +``` + +#### Parameters + +- `msg` *string* + The message you want to print out. + ## UUID This module provides functionality to generate a UUID @@ -105,4 +139,4 @@ function setUUID(ctx, api) { api.v1.user.appendMetadata('custom-id', uuid.v4()); } -``` \ No newline at end of file +```