1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-07-31 02:10:22 +02:00

Fix minor spelling & grammar issues in docs (#1623)

This commit is contained in:
gnito-org
2022-03-06 10:12:11 -04:00
committed by GitHub
parent c295434c24
commit c0ae588437
3 changed files with 11 additions and 11 deletions

View File

@@ -127,7 +127,7 @@ $logger->info('Adding a new user', ['username' => 'Seldaek']);
Simple handlers (like the StreamHandler for instance) will simply format
the array to a string but richer handlers can take advantage of the context
(FirePHP is able to display arrays in pretty way for instance).
(FirePHP is able to display arrays in a pretty way for instance).
### Using processors
@@ -196,7 +196,7 @@ As mentioned before, a *Formatter* is attached to a *Handler*, and as a general
```php
$record['formatted']
```
field in the log record to store its formatted value. Again, this field depends on the implemenation of the *Handler* but is a good idea to **stick into the good practices and conventions of the project**.
field in the log record to store its formatted value. Again, this field depends on the implementation of the *Handler* but is a good idea to **stick into the good practices and conventions of the project**.
You can choose between predefined formatter classes or write your own (e.g. a multiline text file for human-readable output).
@@ -205,8 +205,8 @@ You can choose between predefined formatter classes or write your own (e.g. a mu
> A very useful formatter to look at, is the `LineFormatter`.
>
> This formatter, as its name might indicate, is able to return a lineal string representation of the log record provided.
>
> It is also capable to interpolate values from the log record, into the output format template used by the formatter to generate the final result, and in order to do it, you need to provide the log record values you are interested in, in the output template string using the form %value%, e.g: "'%context.foo% => %extra.foo%'" , in this example the values $record["context"]["foo"] and $record["extra"]["foo"] will be render as part of th final result.
>
> It is also capable to interpolate values from the log record, into the output format template used by the formatter to generate the final result, and in order to do it, you need to provide the log record values you are interested in, in the output template string using the form %value%, e.g: "'%context.foo% => %extra.foo%'" , in this example the values $record["context"]["foo"] and $record["extra"]["foo"] will be render as part of the final result.
In the following example, we demonstrate how to:
1. Create a `LineFormatter` instance and set a custom output format template.
@@ -222,7 +222,7 @@ In the following example, we demonstrate how to:
$dateFormat = "Y n j, g:i a";
// the default output format is "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"
// we now change the default output format according our needs.
// we now change the default output format according to our needs.
$output = "%datetime% > %level_name% > %message% %context% %extra%\n";
// finally, create a formatter

View File

@@ -16,7 +16,7 @@
### Log to files and syslog
- [_StreamHandler_](https://github.com/Seldaek/monolog/blob/main/src/Monolog/Handler/StreamHandler.php): Logs records into any PHP stream, use this for log files.
- [_RotatingFileHandler_](https://github.com/Seldaek/monolog/blob/main/src/Monolog/Handler/RotatingFileHandler.php): Logs records to a file and creates one logfile per day.
- [_RotatingFileHandler_](https://github.com/Seldaek/monolog/blob/main/src/Monolog/Handler/RotatingFileHandler.php): Logs records to a file and creates one log file per day.
It will also delete files older than `$maxFiles`. You should use
[logrotate](https://linux.die.net/man/8/logrotate) for high profile
setups though, this is just meant as a quick and dirty solution.
@@ -111,10 +111,10 @@
where a remote tcp connection may have died but you do not want your entire
application to crash and may wish to continue to log to other handlers.
- [_FallbackGroupHandler_](https://github.com/Seldaek/monolog/blob/main/src/Monolog/Handler/FallbackGroupHandler.php): This handler extends the _GroupHandler_ ignoring
exceptions raised by each child handler, until one has handled without throwing.
This allows you to ignore issues where a remote tcp connection may have died
but you do not want your entire application to crash and may wish to continue
to attempt log to other handlers, until one does not throw.
exceptions raised by each child handler, until one has handled without throwing.
This allows you to ignore issues where a remote tcp connection may have died
but you do not want your entire application to crash and may wish to continue
to attempt logging to other handlers, until one does not throw an exception.
- [_BufferHandler_](https://github.com/Seldaek/monolog/blob/main/src/Monolog/Handler/BufferHandler.php): This handler will buffer all the log records it receives
until `close()` is called at which point it will call `handleBatch()` on the
handler it wraps with all the log messages at once. This is very useful to

View File

@@ -15,4 +15,4 @@ extra | array | A placeholder array where processors ca
At first glance `context` and `extra` look very similar, and they are in the sense that they both carry arbitrary data that is related to the log message somehow.
The main difference is that `context` can be supplied in user land (it is the 3rd parameter to `Logger::addRecord()`) whereas `extra` is internal only and can be filled by processors.
The reason processors write to `extra` and not to `context` is to prevent overriding any user provided data in `context`.
The reason processors write to `extra` and not to `context` is to prevent overriding any user-provided data in `context`.