From 7db4964a5f8eb565cd0fb9105f8580e017868324 Mon Sep 17 00:00:00 2001 From: Joan Leon Date: Mon, 14 Oct 2024 15:16:42 +0200 Subject: [PATCH 1/2] feat(packages/sui-logger): improve the documentation --- packages/sui-logger/README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/sui-logger/README.md b/packages/sui-logger/README.md index c384be17a..92628697c 100644 --- a/packages/sui-logger/README.md +++ b/packages/sui-logger/README.md @@ -102,6 +102,19 @@ Enabled by default, there is a ENV var to disable it `DISABLE_SERVER_LOGGER_PATC #### With Reporter +> The Reporter needs a `star` method to inicialize the reporter. + +```js +export const initTracker = ({Reporter, appName, environment, version, tenant, ...config}) => { + const context = {environment: environment || NODE_ENV, isServer, version, tenant} + + Reporter.start(appName, { + ...config, + context + }) +} +``` + To start logging server-side logs in our application, we should initialize our tracker in one server file ```js @@ -119,7 +132,7 @@ Options: - **`devMode` {String}** - Allows sending events to the development endpoint, Production endpoint is used by default. - **`...rest`** - See your Service Logger client configuration -After initializing our tracker, we could create our logger +After initializing our tracker, we could create our logger. ```js import {createServerLogger} from '@s-ui/logger' From 145ca427a72e411b10b86824b48b692be41c4d28 Mon Sep 17 00:00:00 2001 From: Joan Leon Date: Mon, 14 Oct 2024 15:20:04 +0200 Subject: [PATCH 2/2] fix(packages/sui-logger): fix typo --- packages/sui-logger/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sui-logger/README.md b/packages/sui-logger/README.md index 92628697c..0d10e4d66 100644 --- a/packages/sui-logger/README.md +++ b/packages/sui-logger/README.md @@ -102,7 +102,7 @@ Enabled by default, there is a ENV var to disable it `DISABLE_SERVER_LOGGER_PATC #### With Reporter -> The Reporter needs a `star` method to inicialize the reporter. +> The Reporter needs a `start` method to inicialize the reporter. ```js export const initTracker = ({Reporter, appName, environment, version, tenant, ...config}) => {