Skip to content

Commit 2a29bf5

Browse files
committed
Improve the documentation
1 parent e0518d1 commit 2a29bf5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ All you need to log with [Bref](https://bref.sh) on AWS Lambda.
33
[![Build Status](https://img.shields.io/travis/brefphp/logger/master.svg?style=flat-square)](https://travis-ci.org/brefphp/logger)
44
[![Latest Version](https://img.shields.io/github/release/bref/logger.svg?style=flat-square)](https://packagist.org/packages/bref/logger)
55

6-
Bref/Logger is a lightweight [PSR-3](https://www.php-fig.org/psr/psr-3/) logger for AWS Lambda. Messages are sent to stderr so that they end up in [CloudWatch](https://bref.sh/docs/environment/logs.html).
6+
Bref/Logger is a lightweight [PSR-3](https://www.php-fig.org/psr/psr-3/) logger for AWS Lambda. Messages are sent to `stderr` so that they end up in [CloudWatch](https://bref.sh/docs/environment/logs.html).
77

88
## Why?
99

10-
As explained in [the Bref documentation](https://bref.sh/docs/environment/logs.html), logging in AWS Lambda means logging to stderr. Logs written to stderr are automatically sent to CloudWatch, AWS' solution to collect and view logs.
10+
As explained in [the Bref documentation](https://bref.sh/docs/environment/logs.html), logging in AWS Lambda means logging to `stderr`. Logs written to `stderr` are automatically sent to [CloudWatch](https://aws.amazon.com/cloudwatch/), AWS' solution to collect and view logs.
1111

12-
While classic loggers like [Monolog](https://github.com/Seldaek/monolog) work fine, this logger comes as a simpler and lighter alternative. It does not require any configuration and currently contains a single class.
12+
While classic loggers like [Monolog](https://github.com/Seldaek/monolog) work fine, this logger comes as a simpler and lighter alternative optimized for AWS Lambda. It does not require any configuration and currently contains a single class.
1313

1414
Since it is [PSR-3](https://www.php-fig.org/psr/psr-3/) compliant, Bref/Logger is also compatible with any framework or library consuming a PSR-3 logger.
1515

@@ -43,7 +43,9 @@ $logger->error('This is an error');
4343
[ERROR] This is an error
4444
```
4545

46-
[PSR-3 placeholders](https://www.php-fig.org/psr/psr-3/#12-message) can be used to insert information into a message without having to concatenate strings manually:
46+
### Message placeholders
47+
48+
[PSR-3 placeholders](https://www.php-fig.org/psr/psr-3/#12-message) can be used to insert information from the `$context` array into the message without having to concatenate strings manually:
4749

4850
```php
4951
$logger->warning('Invalid login attempt for email {email}', [
@@ -56,6 +58,8 @@ $logger->warning('Invalid login attempt for email {email}', [
5658
[WARNING] Invalid login attempt for email johndoe@example.com
5759
```
5860

61+
### Logging exceptions
62+
5963
Exceptions [can be logged](https://www.php-fig.org/psr/psr-3/#13-context) under the `exception` key:
6064

6165
```php

0 commit comments

Comments
 (0)