Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes information about monolog log format #646

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions docs/en/basics/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,23 @@ return [
> **Note**
> Use `MONOLOG_DEFAULT_CHANNEL` env variable to specify the default handler that should be used in your application.

### Log format

By default, the handler will format the log message using the following
structure `[%datetime%] %level_name%: %message% %context%\n`.

If you want to change the log message structure, you can set up the `MONOLOG_FORMAT` evn variable like in the example
below:

```dotenv .env
MONOLOG_FORMAT=[%datetime%] %level_name%: %message% %context%\n
```

> **See more**
> Read more about the available placeholders in
> the [Monolog documentation](https://seldaek.github.io/monolog/doc/message-structure.html).


## Register handler

In addition to configuring the logging component through a config file or bootloader, you can also register handlers via
Expand Down Expand Up @@ -180,18 +197,6 @@ return [

::::

By default, the handler will format the log message using the following structure `%message% %context% %extra%\n`

If you want to change the log message structure, you can use the `LOGGER_FORMAT` evn variable:

```dotenv .env
LOGGER_FORMAT=[%datetime%] %channel%.%level%: %message% %context% %extra%\n
```

> **See more**
> Read more about the available placeholders in
> the [Monolog documentation](https://seldaek.github.io/monolog/doc/message-structure.html).

## Usage

### Send logs to the default channel
Expand Down