Skip to content

Commit 3af2cac

Browse files
committed
revert: order to APP logger/service name due to screenshots
1 parent 4b94856 commit 3af2cac

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

docs/quickstart.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ The first option could be to use the standard Python Logger, and use a specializ
384384

385385
from aws_lambda_powertools.event_handler.api_gateway import ApiGatewayResolver
386386

387-
logger = logging.getLogger("hello")
387+
logger = logging.getLogger("APP")
388388
logHandler = logging.StreamHandler()
389389
formatter = jsonlogger.JsonFormatter(fmt="%(asctime)s %(levelname)s %(name)s %(message)s")
390390
logHandler.setFormatter(formatter)
@@ -431,7 +431,7 @@ After that, we use this logger in our application code to record the required in
431431
{
432432
"asctime": "2021-11-22 15:32:02,145",
433433
"levelname": "INFO",
434-
"name": "hello",
434+
"name": "APP",
435435
"message": "Request from unknown received"
436436
}
437437
```
@@ -461,7 +461,7 @@ from aws_lambda_powertools import Logger
461461
from aws_lambda_powertools.event_handler.api_gateway import ApiGatewayResolver
462462
from aws_lambda_powertools.logging import correlation_paths
463463

464-
logger = Logger(service="order")
464+
logger = Logger(service="APP")
465465

466466
app = ApiGatewayResolver()
467467

@@ -490,7 +490,6 @@ Let's break this down:
490490
* **L24**: We also instruct Logger to use the incoming API Gateway Request ID as a [correlation id](./core/logger.md##set_correlation_id-method) automatically.
491491
* **L24**: Since we're in dev, we also use `log_event=True` to automatically log each incoming request for debugging. This can be also set via [environment variables](./index.md#environment-variables){target="_blank"}.
492492

493-
We can now search our logs by the request ID to find a specific operation. Additionally, we can also search our logs for function name, Lambda request ID, Lambda function ARN, find out whether an operation was a cold start, etc.
494493

495494
This is how the logs would look like now:
496495

@@ -500,7 +499,7 @@ This is how the logs would look like now:
500499
"location":"hello:17",
501500
"message":"Request from unknown received",
502501
"timestamp":"2021-10-22 16:29:58,367+0000",
503-
"service":"hello",
502+
"service":"APP",
504503
"cold_start":true,
505504
"function_name":"HelloWorldFunction",
506505
"function_memory_size":"256",
@@ -510,6 +509,8 @@ This is how the logs would look like now:
510509
}
511510
```
512511

512+
We can now search our logs by the request ID to find a specific operation. Additionally, we can also search our logs for function name, Lambda request ID, Lambda function ARN, find out whether an operation was a cold start, etc.
513+
513514
From here, we could [set specific keys](./core/logger.md#append_keys-method){target="_blank"} to add additional contextual information about a given operation, [log exceptions](./core/logger.md#logging-exceptions){target="_blank"} to easily enumerate them later, [sample debug logs](./core/logger.md#sampling-debug-logs){target="_blank"}, etc.
514515

515516
By having structured logs like this, we can easily search and analyse them in [CloudWatch Logs Insight](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AnalyzingLogData.html){target="_blank"}.

0 commit comments

Comments
 (0)