Download the PHP package analog/analog without Composer
On this page you can find all versions of the php package analog/analog. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Short Description Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.
All versions of analog with dependencies
Informations about the package analog
Analog - Minimal PHP logging library
- Copyright: (c) 2012-Present Johnny Broadway
- License: MIT
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),
or use the
Analog\Logger wrapper that implements the
Install the latest version with:
Usage with PSR-3
Usage with a custom handler
Usage without composer
Analog uses a simple autoloader internally, so if you don't have access to composer you can clone this repository and include it like this:
For more examples, see the examples folder.
By default, this class will write to a file named
sys_get_temp_dir() . '/analog.txt'
using the format
"machine - date - level - message\n", making it usable with no
Analog also comes with dozens of pre-written handlers in the Analog/Handlers folder, with examples for each in the examples folder. These include:
- Amon - Send logs to the Amon server monitoring tool
- Apprise - Send notifications through the apprise command line tool
- Buffer - Buffer messages to send all at once (works with File, Mail, Stderr, and Variable handlers)
- ChromeLogger - Sends messages to Chrome Logger browser plugin
- EchoConsole - Echo output directly to the console
- File - Append messages to a file
- FirePHP - Send messages to FirePHP browser plugin
- GELF - Send message to the Graylog2 log management server
- IFTTT - Trigger webhooks via the IFTTT service
- Ignore - Do nothing
- LevelBuffer - Buffer messages and send only if sufficient error level reached
- LevelName - Convert log level numbers to names in log output
- Mail - Send email notices
- Mongo - Save to MongoDB collection
- Multi - Send different log levels to different handlers
- PDO - Send messages to any PDO database connection (MySQL, SQLite, PostgreSQL, etc.)
- Post - Send messages over HTTP POST to another machine
- Redis - Save messages to Redis key using RPUSH
- Slackbot - Post messages to Slack via Slackbot
- Stderr - Send messages to STDERR
- Syslog - Send messages to syslog
- Threshold - Only writes log messages above a certain threshold
- Variable - Buffer messages to a variable reference
- WPMail - Send email notices using Wordpress
So while it's a micro class, it's highly extensible and very capable out of the box too.
I wrote this because I wanted something very small and simple like KLogger, and preferably not torn out of a wider framework if possible. After searching, I wasn't happy with the single-purpose libraries I found. With KLogger for example, I didn't want an object instance but rather a static class, and I wanted more flexibility in the back-end.
I also found some that had the flexibility also had more complexity, for example Monolog is dozens of source files (not incl. tests). With closures, this seemed to be a good balance of small without sacrificing flexibility.
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 :)