pax_global_header 0000666 0000000 0000000 00000000064 12530637205 0014515 g ustar 00root root 0000000 0000000 52 comment=69615c0e8b4033169b45d58f778fd3ba638d1d52
analog-1.0.7-stable/ 0000775 0000000 0000000 00000000000 12530637205 0014233 5 ustar 00root root 0000000 0000000 analog-1.0.7-stable/.gitignore 0000664 0000000 0000000 00000000030 12530637205 0016214 0 ustar 00root root 0000000 0000000 vendor/*
/composer.lock
analog-1.0.7-stable/.travis.yml 0000664 0000000 0000000 00000000260 12530637205 0016342 0 ustar 00root root 0000000 0000000 language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm
before_script: composer install --no-interaction --prefer-source
script: phpunit --coverage-text --verbose
analog-1.0.7-stable/LICENSE 0000664 0000000 0000000 00000002064 12530637205 0015242 0 ustar 00root root 0000000 0000000 The MIT License
Copyright (c) 2012 Johnny Broadway
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
analog-1.0.7-stable/README.md 0000664 0000000 0000000 00000012175 12530637205 0015520 0 ustar 00root root 0000000 0000000 ## Analog - PHP 5.3+ micro logging package [](https://travis-ci.org/jbroadway/analog)
* Copyright: (c) 2012 Johnny Broadway
* License: http://www.opensource.org/licenses/mit-license.php
A [MicroPHP](http://microphp.org/) 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://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md).
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
customization necessary.
Analog also comes with over a dozen pre-written handlers in the Analog/Handlers folder,
with examples for each in the examples folder. These include:
* Amon - Send logs to the [Amon](http://amon.cx/) server monitoring tool
* Buffer - Buffer messages to send all at once (works with File, Mail, Stderr, and Variable handlers)
* ChromeLogger - Sends messages to [Chrome Logger](http://craig.is/writing/chrome-logger) browser plugin
* File - Append messages to a file
* FirePHP - Send messages to [FirePHP](http://www.firephp.org/) browser plugin
* GELF - Send message to the [Graylog2](http://www.graylog2.org/) log management server
* Ignore - Do nothing
* LevelBuffer - Buffer messages and send only if sufficient error level reached
* Mail - Send email notices
* Mongo - Save to MongoDB collection
* Multi - Send different log levels to different handlers
* Post - Send messages over HTTP POST to another machine
* 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.
So while it's a micro class, it's highly extensible and very capable out of the box too.
### Rationale
I wrote this because I wanted something very small and simple like
[KLogger](https://github.com/katzgrau/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](https://github.com/Seldaek/monolog) is 25 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 :)
### Usage
Basic usage, with a custom handler function:
```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 with [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md),
[Composer](http://getcomposer.org/), and the FirePHP handler:
1\. Create a `composer.json` file in the root of your project with the following contents.
```json
{
"require": {
"analog/analog": "dev-master"
}
}
```
2\. Run `php composer.phar install` from the terminal in the root of your project.
3\. Include Composer's autoloader and use the `Analog\Analog` class.
```php
```
Usage with [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md),
[Composer](http://getcomposer.org/), and the Variable handler:
1\. Create a `composer.json` file in the root of your project with the following contents.
```json
{
"require": {
"analog/analog": "dev-master"
}
}
```
2\. Run `php composer.phar install` from the terminal in the root of your project.
3\. Include Composer's autoloader and use the `Analog\Logger` class.
```php
handler (Analog\Handler\Variable::init ($log));
$logger->alert ('Things are really happening right now!');
var_dump ($log);
?>
```
For more examples, see the [examples](https://github.com/jbroadway/analog/tree/master/examples) folder.
analog-1.0.7-stable/composer.json 0000664 0000000 0000000 00000001213 12530637205 0016752 0 ustar 00root root 0000000 0000000 {
"name": "analog/analog",
"type": "library",
"description": "PHP 5.3+ micro logging class that can be extended via closures. Includes several pre-built handlers including file, mail, syslog, HTTP post, and MongoDB.",
"keywords": ["log", "logging", "logger", "syslog", "error", "debug", "debugging", "alerts"],
"homepage": "https://github.com/jbroadway/analog",
"license": "MIT",
"authors": [
{
"name": "Johnny Broadway",
"email": "johnny@johnnybroadway.com",
"homepage": "http://www.johnnybroadway.com/"
}
],
"require": {
"psr/log": "1.*",
"php": ">=5.3.2"
},
"autoload": {
"psr-0": {
"Analog": "lib/"
}
}
}
analog-1.0.7-stable/examples/ 0000775 0000000 0000000 00000000000 12530637205 0016051 5 ustar 00root root 0000000 0000000 analog-1.0.7-stable/examples/SplClassLoader.php 0000664 0000000 0000000 00000012043 12530637205 0021435 0 ustar 00root root 0000000 0000000 .
*/
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/psr-0-final-proposal?pli=1
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
* $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine');
* $classLoader->register();
*
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @author Jonathan H. Wage
* @author Roman S. Borschel
* @author Matthew Weier O'Phinney
* @author Kris Wallsmith
* @author Fabien Potencier
*/
class SplClassLoader
{
private $_fileExtension = '.php';
private $_namespace;
private $_includePath;
private $_namespaceSeparator = '\\';
/**
* Creates a new SplClassLoader that loads classes of the
* specified namespace.
*
* @param string $ns The namespace to use.
*/
public function __construct($ns = null, $includePath = null)
{
$this->_namespace = $ns;
$this->_includePath = $includePath;
}
/**
* Sets the namespace separator used by classes in the namespace of this class loader.
*
* @param string $sep The separator to use.
*/
public function setNamespaceSeparator($sep)
{
$this->_namespaceSeparator = $sep;
}
/**
* Gets the namespace seperator used by classes in the namespace of this class loader.
*
* @return void
*/
public function getNamespaceSeparator()
{
return $this->_namespaceSeparator;
}
/**
* Sets the base include path for all class files in the namespace of this class loader.
*
* @param string $includePath
*/
public function setIncludePath($includePath)
{
$this->_includePath = $includePath;
}
/**
* Gets the base include path for all class files in the namespace of this class loader.
*
* @return string $includePath
*/
public function getIncludePath()
{
return $this->_includePath;
}
/**
* Sets the file extension of class files in the namespace of this class loader.
*
* @param string $fileExtension
*/
public function setFileExtension($fileExtension)
{
$this->_fileExtension = $fileExtension;
}
/**
* Gets the file extension of class files in the namespace of this class loader.
*
* @return string $fileExtension
*/
public function getFileExtension()
{
return $this->_fileExtension;
}
/**
* Installs this class loader on the SPL autoload stack.
*/
public function register()
{
spl_autoload_register(array($this, 'loadClass'));
}
/**
* Uninstalls this class loader from the SPL autoloader stack.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $className The name of the class to load.
* @return void
*/
public function loadClass($className)
{
if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) {
$fileName = '';
$namespace = '';
if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension;
require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName;
}
}
}
analog-1.0.7-stable/examples/amon.php 0000664 0000000 0000000 00000000432 12530637205 0017513 0 ustar 00root root 0000000 0000000