Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbroadway/analog
PHP logging library that is highly extendable and simple to use.
https://github.com/jbroadway/analog
amon amon2 analog apprise chrome-logger error-monitoring errors firephp gelf logger logging mongodb monitoring php psr-3 stderr syslog
Last synced: 5 days ago
JSON representation
PHP logging library that is highly extendable and simple to use.
- Host: GitHub
- URL: https://github.com/jbroadway/analog
- Owner: jbroadway
- License: mit
- Created: 2012-01-06T22:31:11.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2023-12-10T23:04:37.000Z (about 1 year ago)
- Last Synced: 2024-11-11T06:37:04.365Z (about 1 month ago)
- Topics: amon, amon2, analog, apprise, chrome-logger, error-monitoring, errors, firephp, gelf, logger, logging, mongodb, monitoring, php, psr-3, stderr, syslog
- Language: PHP
- Homepage:
- Size: 160 KB
- Stars: 342
- Watchers: 25
- Forks: 49
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-php-cn - Analog - 一个机遇闭包的微型日志包 (目录 / 日志记录 Logging)
README
# Analog - Minimal PHP logging library
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/jbroadway/analog/ci.yml?branch=master)
![GitHub](https://img.shields.io/github/license/jbroadway/analog)
![Packagist Version](https://img.shields.io/packagist/v/analog/analog)
![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/analog/analog)
![Packagist Downloads](https://img.shields.io/packagist/dt/analog/analog)A minimal PHP logging package based on the idea of using closures
for configurability and extensibility. It functions as a static class, but you can
completely control the writing of log messages through a closure function
(aka [anonymous functions](http://ca3.php.net/manual/en/functions.anonymous.php)),
or use the `Analog\Logger` wrapper that implements the
[PSR-3 specification](https://www.php-fig.org/psr/psr-3/).## Installation
Install the latest version with:
```bash
$ composer require analog/analog
```## Usage
### Basic Usage
```php
handler (Variable::init ($log));$logger->alert ('Things are really happening right now!');
// With context
$logger->debug ('Testing {0}:{1}', [__FILE__, __LINE__]);var_dump ($log);
```### Usage with a custom handler
```php
mydb->log->insert ($info);
});// Log an alert
Analog::log ('The sky is falling!', Analog::ALERT);// Log some debug info
Analog::log ('Debugging info', Analog::DEBUG);
```### Usage without composer
Analog uses a simple autoloader internally, so if you don't have access to [composer](https://getcomposer.org/) you can clone this repository and include it like this:
```php
What about Analog, the logfile analyzer? Well, since it hasn't been updated
> since 2004, I think it's safe to call a single-file PHP logging class the
> same thing without it being considered stepping on toes :)