Recommend this page to a friend! |
Classes of Josantonius | PHP Logger lib | README.md | Download |
|
DownloadPHP Logger libraryPhp library to create logs easily and store them in Json format.
RequirementsThis library is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher. InstallationThe preferred way to install this extension is through Composer. To install PHP Logger library, simply:
The previous command will only install the necessary files, if you prefer to download the entire source code you can use:
You can also clone the complete repository with Git: $ git clone https://github.com/Josantonius/PHP-Logger.git Or install it manually:
Images
Available MethodsAvailable methods in this library: - Initiator for site debug management:
| Atttribute | Description | Type | Required | Default | --- | --- | --- | --- | --- | | $path | Path name to save file with logs. | string | No | null | | $filename | JSON file name that will save the logs. | string | No | null | | $logNumber | Maximum number of logs to save to file. | int | No | 200 | | $ip | If you want to get to another library. | string | No | null | | $states | Different states for logs. | array | No | null | # Return (void) - Save log line:
| Atttribute | Description | Type | Required | Default | --- | --- | --- | --- | --- | | $type | Error type or warning. | string | Yes | | | $code | HTTP response status code. | int | Yes | | | $message | Message. | string | Yes | | | $line | Line from which the save is executed. | int | Yes | | | $file | Filepath from which the method is called. | string | Yes | | | $data | Extra custom parameters. | array | No | 0 | # Return (boolean) - Save logs to Json file:
# Return (boolean) - Get saved logs:
# Return (array) ? logs saved - Define directory for scripts and get url from file:
| Atttribute | Description | Type | Required | Default | --- | --- | --- | --- | --- | | $url | File url. | string | Yes | | # Return (string) ? file url - Define directory for styles and get url from file:
| Atttribute | Description | Type | Required | Default | --- | --- | --- | --- | --- | | $url | File url. | string | Yes | | # Return (string) ? file url - Get number of logs added in the current section:
# Return (int) ? logs added in the current section - Display logger section:
# Return (boolean true) - Reset parameters:
# Return (boolean true) Quick StartTo use this library with Composer:
Or If you installed it manually, use it:
UsageExample of use for this library: - Basic example
- Advanced example
TestsTo run tests you just need Composer and to execute the following:
Run unit tests with PHPUnit:
Run PSR2 code standard tests with PHPCS:
Run all previous tests:
? TODO
Contribute
This is intended for large and long-lived objects. RepositoryAll files in this repository were created and uploaded automatically with Reposgit Creator. LicenseThis project is licensed under MIT license. See the LICENSE file for more info. Copyright2017 Josantonius, josantonius.com If you find it useful, let me know :wink: |