You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/4.sdk/2.getting-started/4.logger.md
+46-40Lines changed: 46 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Logger
2
2
3
-
The Logger provides a logging utility for Alokai Storefront projects. It allows you to log messages at various levels and ability to provide additional context.
3
+
The Logger provides a logging utility for Alokai Storefront projects. It allows you to log messages at various levels and ability to provide additional context.
4
4
5
5
It is created to provide a unified way of logging messages across the project along with providing additional data out of the box.
6
6
@@ -14,7 +14,7 @@ In order to install the Logger, you need to update following packages to at leas
14
14
*`@vue-storefront/sdk` to `3.3.0`
15
15
*`@vue-storefront/nuxt` to `6.2.0`
16
16
*`@vue-storefront/next` to `4.3.0`
17
-
17
+
18
18
After updating the packages, you need to provide the Logger module to the SDK config.
The default configuration is already provided, but you can customize it by providing the following options:
55
55
56
-
* `level` - the minimum level of the message to be logged. The default value is `info`.
56
+
* `level` - the minimum level of the message to be logged. The default value is `info`. Possible values are:
57
+
* `emergency`
58
+
* `alert`
59
+
* `critical`
60
+
* `error`
61
+
* `warning`
62
+
* `notice`
63
+
* `info`
64
+
* `debug`
57
65
* `includeStackTrace` - a boolean value that determines if the stack trace should be included in the log message. The default value is `true`.
58
66
* `handler` - a custom handler that will be called when the message is logged.
59
67
60
-
```ts
61
-
type LoggerModuleConfig = Partial<{
62
-
level: LogLevel;
63
-
includeStackTrace: boolean;
64
-
handler: LoggerInterface;
65
-
[key: string]: any;
66
-
}>;
67
-
typeLogLevel=
68
-
|"emergency"
69
-
|"alert"
70
-
|"critical"
71
-
|"error"
72
-
|"warning"
73
-
|"notice"
74
-
|"info"
75
-
|"debug";
76
-
```
77
-
78
68
To provide the configuration for the Logger, you need to update the SDK config with the Logger module configuration by providing an object with options to the `buildModule` function, e.g.:
79
69
```ts
80
70
// ...
@@ -92,25 +82,6 @@ Then you can provide your own custom handler for the Logger. The handler must im
92
82
Keep in mind that if you provide a custom handler, it will override the built-in logging functions and the other options passed to the Logger configuration will be ignored.
0 commit comments