Skip to content

Commit 97965da

Browse files
committed
docs(logger): new observability provider section
1 parent 35a3195 commit 97965da

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

docs/core/logger.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,26 @@ If you prefer configuring it separately, or you'd want to bring this JSON Format
445445
--8<-- "examples/logger/src/powertools_formatter_setup.py"
446446
```
447447

448+
### Observability providers
449+
450+
!!! note "In this context, an observability provider is an [AWS Lambda Partner](https://go.aws/3HtU6CZ){target="_blank"} offering a platform for logging, metrics, traces, etc."
451+
452+
You can send logs to the observability provider of your choice via [Lambda Extensions](https://aws.amazon.com/blogs/compute/using-aws-lambda-extensions-to-send-logs-to-custom-destinations/){target="_blank"}. In most cases, you shouldn't need any custom Logger configuration, and logs will be shipped async without any performance impact.
453+
454+
#### Built-in formatters
455+
456+
In rare circumstances where JSON logs are not parsed correctly by your provider, we offer built-in formatters to make this transition easier.
457+
458+
| Provider | Formatter | Notes |
459+
| -------- | --------------------- | ---------------------------------------------------- |
460+
| Datadog | `DatadogLogFormatter` | Modifies default timestamp to use RFC3339 by default |
461+
462+
You can use import and use them as any other Logger formatter via `logger_formatter` parameter:
463+
464+
```python hl_lines="2 4" title="Using built-in Logger Formatters"
465+
--8<-- "examples/logger/src/observability_provider_builtin_formatters.py"
466+
```
467+
448468
### Migrating from other Loggers
449469

450470
If you're migrating from other Loggers, there are few key points to be aware of: [Service parameter](#the-service-parameter), [Inheriting Loggers](#inheriting-loggers), [Overriding Log records](#overriding-log-records), and [Logging exceptions](#logging-exceptions).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from aws_lambda_powertools import Logger
2+
from aws_lambda_powertools.logging.formatters import DatadogLogFormatter
3+
4+
logger = Logger(service="payment", logger_formatter=DatadogLogFormatter())
5+
logger.info("hello")

0 commit comments

Comments
 (0)