-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from dotkernel/issue-40
updated docs
- Loading branch information
Showing
6 changed files
with
51 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# Adding The Config Provider | ||
|
||
* Enter config/config.php | ||
* If there is no entry for the config provider below, add it: | ||
`\Dot\Log\ConfigProvider::class` | ||
* Make sure it is added before with the Application-Specific components, eg.: \Frontend\App\ConfigProvider.php, `\Admin\App\ConfigProvider::class`, `MyProject\ConfigProvider::class` , etc. | ||
* Open the `Dot\Log\ConfigProvider` | ||
* In the dependencies section you will see an abstract factory (LoggerAbstractServiceFactory::class) | ||
* This class responds to "selectors" instead of class names | ||
Instead of requesting the `Laminas\Log\Logger::class`from the container, dot-log.my_logger should be requested (or just `my_logger` if using laminas-log) | ||
* In `config/config.php` add an entry for the config provider `\Dot\Log\ConfigProvider::class` | ||
* Make sure it is added before with the Application-Specific components, eg.: | ||
* `\Frontend\App\ConfigProvider.php` | ||
* `\Admin\App\ConfigProvider::class` | ||
* `\MyProject\ConfigProvider::class` etc. | ||
* Add the logger configuration in an autoload config file, e.g. you can create `config/autoload/logger.global.php`. Follow the `Configuring the writer(s)` chapter for a simple working example. | ||
|
||
Note: `Dot\Log\ConfigProvider` has an abstract factory `LoggerAbstractServiceFactory::class` which corresponds to the alias, not the class name. Instead of requesting `Laminas\Log\Logger::class` from the container, use `dot-log.my_logger` (or just `my_logger` if using laminas-log). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
# Formatting Messages | ||
|
||
When using `dot-log` or `laminas-log`, the logged value is not limited to a string. Arrays can be logged as well. | ||
|
||
For a better readability, these arrays can be serialized. | ||
|
||
Laminas Log provides String formatting, XML, JSON and FirePHP formatting. | ||
When using `dot-log` or `laminas-log`, the logged value is not limited to a string. Arrays can be logged as well. For better readability, these arrays can be serialized. Laminas Log provides String, XML, JSON and FirePHP formatting. | ||
|
||
The formatter accepts following parameters: | ||
|
||
name - the formatter class (it must implement Laminas\Log\Formatter\FormatterInterface) | ||
options - options to pass to the formatter constructor if required | ||
* name - the formatter class (it must implement `Laminas\Log\Formatter\FormatterInterface`) | ||
* options - passed to the formatter constructor if required | ||
|
||
The following formats the message as JSON data: | ||
The following snippet formats the message as JSON data: | ||
|
||
'formatter' => [ | ||
'name' => \Laminas\Log\Formatter\Json::class, | ||
], | ||
'formatter' => [ | ||
'name' => \Laminas\Log\Formatter\Json::class, | ||
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
# Grouping log files by date | ||
|
||
By default, logs will be written to the same file: `log/dk.log`. | ||
Optionally, you can use date format specifiers wrapped between curly braces in your FileWriter's `stream` option, automatically grouping your logs by day, week, month, year etc. | ||
|
||
Optionally, you can use date format specifiers wrapped between curly braces in your FileWriter's `stream` option to automatically group your logs by day, week, month, year etc. | ||
|
||
Examples: | ||
|
||
* `log/dk-{Y}-{m}-{d}.log` will write every day to a different file (eg: log/dk-2021-01-01.log) | ||
* `log/dk-{Y}-{W}.log` will write every week to a different file (eg: log/dk-2021-10.log) | ||
* `log/dk-{Y}-{m}-{d}.log` will create a new log file each day (eg: log/dk-2021-01-01.log) | ||
* `log/dk-{Y}-{W}.log` will create a new log file each week (eg: log/dk-2021-10.log) | ||
|
||
The full list of format specifiers is available [here](https://www.php.net/manual/en/datetime.format.php). |