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: README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ You can use Powertools for AWS Lambda (TypeScript) by installing it with your fa
44
44
45
45
### Examples
46
46
47
-
You can find examples of how to use Powertools for AWS Lambda (TypeScript) in the [examples](https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/examples/app) directory. The application is a simple REST API that can be deployed via either AWS CDK or AWS SAM.
47
+
You can find examples of how to use Powertools for AWS Lambda (TypeScript) in the [examples](https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/examples) directory. The directory contains code snippets around certain features as well as an is a simple REST API application that can be deployed via either AWS CDK or AWS SAM.
Copy file name to clipboardExpand all lines: docs/contributing/conventions.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ Additionally, we try to share common runtime code between utilities to reduce ma
34
34
35
35
There are also a few other workspaces that are not utilities published to npm, but that still share dependencies and/or runtime code with the utilities. These workspaces are:
36
36
37
-
*`docs/snippets`: contains the documentation code snippets
37
+
*`examples/snippets`: contains the documentation code snippets
38
38
*`examples/app`: contains an example project that can be deployed via AWS CDK or AWS SAM
39
39
*`layers`: contains the code used to build and publish the [Lambda layers](../index.md#lambda-layer)
Copy file name to clipboardExpand all lines: docs/core/logger.md
+18-18
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ The `Logger` utility must always be instantiated outside the Lambda handler. By
37
37
=== "handler.ts"
38
38
39
39
```typescript hl_lines="1 3"
40
-
--8<-- "docs/snippets/logger/basicUsage.ts"
40
+
--8<-- "examples/snippets/logger/basicUsage.ts"
41
41
```
42
42
43
43
### Utility settings
@@ -60,7 +60,7 @@ Check API docs to learn more about [Logger constructor options](https://docs.pow
60
60
=== "handler.ts"
61
61
62
62
```typescript hl_lines="1 4"
63
-
--8<-- "docs/snippets/logger/sam.ts"
63
+
--8<-- "examples/snippets/logger/sam.ts"
64
64
```
65
65
66
66
=== "template.yaml"
@@ -115,7 +115,7 @@ This functionality will include the following keys in your structured logs:
115
115
Check their docs to learn more about [Middy and its middleware stack](https://middy.js.org/docs/intro/getting-started){target="_blank"} as well as [best practices when working with Powertools](https://middy.js.org/docs/integrations/lambda-powertools#best-practices){target="_blank"}.
116
116
117
117
```typescript hl_lines="2 14"
118
-
--8<-- "docs/snippets/logger/middy.ts"
118
+
--8<-- "examples/snippets/logger/middy.ts"
119
119
```
120
120
121
121
=== "Decorator"
@@ -128,15 +128,15 @@ This functionality will include the following keys in your structured logs:
128
128
If this is not the desired behavior, you can call the `logger.injectLambdaContext()` method directly in your handler.
129
129
130
130
```typescript hl_lines="8"
131
-
--8<-- "docs/snippets/logger/decorator.ts"
131
+
--8<-- "examples/snippets/logger/decorator.ts"
132
132
```
133
133
134
134
1. Binding your handler method allows your handler to access `this` within the class methods.
135
135
136
136
=== "Manual"
137
137
138
138
```typescript hl_lines="10"
139
-
--8<-- "docs/snippets/logger/manual.ts"
139
+
--8<-- "examples/snippets/logger/manual.ts"
140
140
```
141
141
142
142
In each case, the printed log will look like this:
@@ -168,13 +168,13 @@ When debugging in non-production environments, you can instruct Logger to log th
1. Binding your handler method allows your handler to access `this` within the class methods.
@@ -303,7 +303,7 @@ You can append additional data to a single log item by passing objects as additi
303
303
=== "handler.ts"
304
304
305
305
```typescript hl_lines="16-18 23-25 37"
306
-
--8<-- "docs/snippets/logger/extraData.ts"
306
+
--8<-- "examples/snippets/logger/extraData.ts"
307
307
```
308
308
=== "Example CloudWatch Logs excerpt"
309
309
@@ -356,7 +356,7 @@ The error will be logged with default key name `error`, but you can also pass yo
356
356
=== "handler.ts"
357
357
358
358
```typescript hl_lines="13 20-22"
359
-
--8<-- "docs/snippets/logger/logError.ts"
359
+
--8<-- "examples/snippets/logger/logError.ts"
360
360
```
361
361
362
362
=== "Example CloudWatch Logs excerpt"
@@ -414,7 +414,7 @@ We support the following log levels:
414
414
You can access the current log level by using the `getLevelName()` method. This method returns the name of the current log level as a string. If you want to change the log level at runtime, you can use the `setLogLevel()` method. This method accepts a string value that represents the log level you want to set, both lower and upper case values are supported.
415
415
416
416
```typescript
417
-
--8<--"docs/snippets/logger/logLevel.ts"
417
+
--8<--"examples/snippets/logger/logLevel.ts"
418
418
```
419
419
420
420
If you want to access the numeric value of the current log level, you can use the `level` property. For example, if the current log level is `INFO`, `logger.level` property will return `12`.
@@ -480,7 +480,7 @@ Once a child logger is created, the logger and its parent will act as separate i
480
480
=== "handler.ts"
481
481
482
482
```typescript hl_lines="16-18"
483
-
--8<-- "docs/snippets/logger/createChild.ts"
483
+
--8<-- "examples/snippets/logger/createChild.ts"
484
484
```
485
485
486
486
=== "Example CloudWatch Logs excerpt"
@@ -534,7 +534,7 @@ Sampling decision happens at the Logger initialization. This means sampling may
@@ -205,13 +205,13 @@ You can add default dimensions to your metrics by passing them as parameters in
205
205
Check their docs to learn more about [Middy and its middleware stack](https://middy.js.org/docs/intro/getting-started){target="_blank"} as well as [best practices when working with Powertools](https://middy.js.org/docs/integrations/lambda-powertools#best-practices){target="_blank"}.
0 commit comments