https://github.com/hopex-development/simplog
The library contains a simple class and it's facade, for simple data and exception logging.
https://github.com/hopex-development/simplog
logging php7
Last synced: about 1 year ago
JSON representation
The library contains a simple class and it's facade, for simple data and exception logging.
- Host: GitHub
- URL: https://github.com/hopex-development/simplog
- Owner: Hopex-Development
- License: mit
- Created: 2022-12-24T16:55:45.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-18T11:10:36.000Z (about 3 years ago)
- Last Synced: 2025-04-23T01:49:31.660Z (about 1 year ago)
- Topics: logging, php7
- Language: PHP
- Homepage: https://packagist.org/packages/hopex/simplog
- Size: 26.4 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Simple data logging
The library contains a simple class, and it's facade, for simple data and exception logging on JSON format.
## Installing
```
composer require hopex/simplog
```
## Documentation
| Methods | Description | Example for usage |
|:-------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `setWorkDirectory` | Specifies the root directory of the hierarchy of logging levels. It can take several directories in turn one after the other in the form of a standard path. | `setWorkDirectory('logging')`
`setWorkDirectory('logging/sub-folder')` |
| `setLevel` | Specifies the name of the directory where you want to save the logging file. It can't take several directories in turn one after the other in the form of a standard path. | `setLevel('requests')` |
| `setTimeZone` | Specifies the current timezone. | `setTimeZone('UTC')`
`setTimeZone('Europe/Amsterdam')` |
| `setDateFormat` | Sets the time format in the main key of one log element in the logging file. Will not be used if V is specified. | `setDateFormat('H:i:s')`
`setDateFormat('(Y) H:i:s')` |
| `setItemKey` | Sets the primary key of one log element in the logging file. In this case, the current time will not be indicated. | `setItemKey('custom-key')` |
| `setItemsLimit` | Sets the maximum number of elements in a single logging file. The value must be greater than zero. By default, 1000 keys. | `setItemsLimit(10)`
`setItemsLimit(5000)` |
| `setPermissions` | Sets access rights to the logging file. | `setLogFilePermissions(0755)`
`setLogFilePermissions(644)` |
| `setFileName` | Sets the name of the logging file. | `setFileName('my-requests-logs')` |
| `error` | Logging any object as an error message. | Similarly as for `custom`. |
| `warning` | Logging any object as a warning. | Similarly as for `custom`. |
| `info` | Logging of any object as an informational message. | Similarly as for `custom`. |
| `custom` | Logging of any object. | `custom(new SomeClass())`
`custom('Some message')`
`custom(['key' => 'value'])` |
| `exception` | Logging of the exception object with the possibility of adding additional keys. | `exception(new \Exceptions())`
`exception(new \Exceptions(), true)`
`exception(new \Exceptions(), false, ['key' => 'value'])` |
| `clearLevel` | The requirement to clear the directory where the logging file should be saved from other files. | `clearLevel()` |