An open API service indexing awesome lists of open source software.

https://github.com/parseword/pickset

A collection of PHP utilities to quickly "unlock" various capabilities in any application
https://github.com/parseword/pickset

database date-formatting logger php php7 php71 singleton text-processing

Last synced: about 2 months ago
JSON representation

A collection of PHP utilities to quickly "unlock" various capabilities in any application

Awesome Lists containing this project

README

        

# Logger

Logger is a PHP text file logging facility, implemented as a singleton class.

## Usage

Implementing `Logger` in 4 easy steps:

1. Either `composer require parseword/pickset` or copy the `Logger.php` file
into your project.

2. Make sure `Logger.php` is discoverable by your autoloader, or `require_once`
it manually.

3. Throughout your application code, call `Logger::debug()`, `Logger::info()`,
`Logger::warning()` and `Logger::error()` to send log messages of differing
severity levels.

4. In your application's config file or a common include file, you (or the user)
call `Logger::setFilename()` to set the log file, and `Logger::setSeverityFilter()`
to specify which log messages are written to disk.

## Example

In the following example, a file named `/tmp/my.log` is created. The severity
filter is set so that only messages with severity of WARNING or higher will be
written. Messages with lower severity will be disregarded.

```php