Browse Source

more source removal

Hamilton Turner 10 years ago
parent
commit
40949ca9f5
59 changed files with 0 additions and 5355 deletions
  1. 0 67
      frameworks/PHP/php-fuel/fuel/packages/log/CHANGELOG.mdown
  2. 0 19
      frameworks/PHP/php-fuel/fuel/packages/log/LICENSE
  3. 0 120
      frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/AbstractLogger.php
  4. 0 7
      frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/InvalidArgumentException.php
  5. 0 18
      frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/LogLevel.php
  6. 0 17
      frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/LoggerAwareInterface.php
  7. 0 22
      frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/LoggerAwareTrait.php
  8. 0 114
      frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/LoggerInterface.php
  9. 0 131
      frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/LoggerTrait.php
  10. 0 27
      frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/NullLogger.php
  11. 0 116
      frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/Test/LoggerInterfaceTest.php
  12. 0 209
      frameworks/PHP/php-fuel/fuel/packages/log/README.mdown
  13. 0 23
      frameworks/PHP/php-fuel/fuel/packages/log/bootstrap.php
  14. 0 217
      frameworks/PHP/php-fuel/fuel/packages/log/classes/log.php
  15. 0 76
      frameworks/PHP/php-fuel/fuel/packages/log/doc/extending.md
  16. 0 37
      frameworks/PHP/php-fuel/fuel/packages/log/doc/sockets.md
  17. 0 158
      frameworks/PHP/php-fuel/fuel/packages/log/doc/usage.md
  18. 0 79
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/ChromePHPFormatter.php
  19. 0 36
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/FormatterInterface.php
  20. 0 94
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/GelfMessageFormatter.php
  21. 0 38
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/JsonFormatter.php
  22. 0 91
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/LineFormatter.php
  23. 0 98
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/LogstashFormatter.php
  24. 0 101
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/NormalizerFormatter.php
  25. 0 102
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/WildfireFormatter.php
  26. 0 174
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/AbstractHandler.php
  27. 0 66
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/AbstractProcessingHandler.php
  28. 0 69
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/AmqpHandler.php
  29. 0 92
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/BufferHandler.php
  30. 0 126
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/ChromePHPHandler.php
  31. 0 72
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/CouchDBHandler.php
  32. 0 145
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/CubeHandler.php
  33. 0 45
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/DoctrineCouchDBHandler.php
  34. 0 28
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php
  35. 0 32
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php
  36. 0 107
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/FingersCrossedHandler.php
  37. 0 160
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/FirePHPHandler.php
  38. 0 66
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/GelfHandler.php
  39. 0 74
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/GroupHandler.php
  40. 0 88
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/HandlerInterface.php
  41. 0 55
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/MailHandler.php
  42. 0 55
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/MongoDBHandler.php
  43. 0 65
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/NativeMailerHandler.php
  44. 0 45
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/NullHandler.php
  45. 0 79
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/PushoverHandler.php
  46. 0 72
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/RavenHandler.php
  47. 0 109
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/RotatingFileHandler.php
  48. 0 285
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/SocketHandler.php
  49. 0 76
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/StreamHandler.php
  50. 0 55
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/SwiftMailerHandler.php
  51. 0 120
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/SyslogHandler.php
  52. 0 140
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/TestHandler.php
  53. 0 542
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Logger.php
  54. 0 58
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Processor/IntrospectionProcessor.php
  55. 0 40
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Processor/MemoryPeakUsageProcessor.php
  56. 0 50
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Processor/MemoryProcessor.php
  57. 0 40
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Processor/MemoryUsageProcessor.php
  58. 0 42
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Processor/PsrLogMessageProcessor.php
  59. 0 66
      frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Processor/WebProcessor.php

+ 0 - 67
frameworks/PHP/php-fuel/fuel/packages/log/CHANGELOG.mdown

@@ -1,67 +0,0 @@
-* 1.3.1 (2013-01-11)
-
-  * Fixed LogstashFormatter to be usable with stream handlers
-  * Fixed GelfMessageFormatter levels on Windows
-
-* 1.3.0 (2013-01-08)
-
-  * Added PSR-3 compliance, the `Monolog\Logger` class is now an instance of `Psr\Log\LoggerInterface`
-  * Added PsrLogMessageProcessor that you can selectively enable for full PSR-3 compliance
-  * Added LogstashFormatter (combine with SocketHandler or StreamHandler to send logs to Logstash)
-  * Added PushoverHandler to send mobile notifications
-  * Added CouchDBHandler and DoctrineCouchDBHandler
-  * Added RavenHandler to send data to Sentry servers
-  * Added support for the new MongoClient class in MongoDBHandler
-  * Added microsecond precision to log records' timestamps
-  * Added `$flushOnOverflow` param to BufferHandler to flush by batches instead of losing
-    the oldest entries
-  * Fixed normalization of objects with cyclic references
-
-* 1.2.1 (2012-08-29)
-
-  * Added new $logopts arg to SyslogHandler to provide custom openlog options
-  * Fixed fatal error in SyslogHandler
-
-* 1.2.0 (2012-08-18)
-
-  * Added AmqpHandler (for use with AMQP servers)
-  * Added CubeHandler
-  * Added NativeMailerHandler::addHeader() to send custom headers in mails
-  * Added the possibility to specify more than one recipient in NativeMailerHandler
-  * Added the possibility to specify float timeouts in SocketHandler
-  * Added NOTICE and EMERGENCY levels to conform with RFC 5424
-  * Fixed the log records to use the php default timezone instead of UTC
-  * Fixed BufferHandler not being flushed properly on PHP fatal errors
-  * Fixed normalization of exotic resource types
-  * Fixed the default format of the SyslogHandler to avoid duplicating datetimes in syslog
-
-* 1.1.0 (2012-04-23)
-
-  * Added Monolog\Logger::isHandling() to check if a handler will
-    handle the given log level
-  * Added ChromePHPHandler
-  * Added MongoDBHandler
-  * Added GelfHandler (for use with Graylog2 servers)
-  * Added SocketHandler (for use with syslog-ng for example)
-  * Added NormalizerFormatter
-  * Added the possibility to change the activation strategy of the FingersCrossedHandler
-  * Added possibility to show microseconds in logs
-  * Added `server` and `referer` to WebProcessor output
-
-* 1.0.2 (2011-10-24)
-
-  * Fixed bug in IE with large response headers and FirePHPHandler
-
-* 1.0.1 (2011-08-25)
-
-  * Added MemoryPeakUsageProcessor and MemoryUsageProcessor
-  * Added Monolog\Logger::getName() to get a logger's channel name
-
-* 1.0.0 (2011-07-06)
-
-  * Added IntrospectionProcessor to get info from where the logger was called
-  * Fixed WebProcessor in CLI
-
-* 1.0.0-RC1 (2011-07-01)
-
-  * Initial release

+ 0 - 19
frameworks/PHP/php-fuel/fuel/packages/log/LICENSE

@@ -1,19 +0,0 @@
-Copyright (c) Jordi Boggiano
-
-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.

+ 0 - 120
frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/AbstractLogger.php

@@ -1,120 +0,0 @@
-<?php
-
-namespace Psr\Log;
-
-/**
- * This is a simple Logger implementation that other Loggers can inherit from.
- *
- * It simply delegates all log-level-specific methods to the `log` method to
- * reduce boilerplate code that a simple Logger that does the same thing with
- * messages regardless of the error level has to implement.
- */
-abstract class AbstractLogger implements LoggerInterface
-{
-    /**
-     * System is unusable.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function emergency($message, array $context = array())
-    {
-        $this->log(LogLevel::EMERGENCY, $message, $context);
-    }
-
-    /**
-     * Action must be taken immediately.
-     *
-     * Example: Entire website down, database unavailable, etc. This should
-     * trigger the SMS alerts and wake you up.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function alert($message, array $context = array())
-    {
-        $this->log(LogLevel::ALERT, $message, $context);
-    }
-
-    /**
-     * Critical conditions.
-     *
-     * Example: Application component unavailable, unexpected exception.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function critical($message, array $context = array())
-    {
-        $this->log(LogLevel::CRITICAL, $message, $context);
-    }
-
-    /**
-     * Runtime errors that do not require immediate action but should typically
-     * be logged and monitored.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function error($message, array $context = array())
-    {
-        $this->log(LogLevel::ERROR, $message, $context);
-    }
-
-    /**
-     * Exceptional occurrences that are not errors.
-     *
-     * Example: Use of deprecated APIs, poor use of an API, undesirable things
-     * that are not necessarily wrong.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function warning($message, array $context = array())
-    {
-        $this->log(LogLevel::WARNING, $message, $context);
-    }
-
-    /**
-     * Normal but significant events.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function notice($message, array $context = array())
-    {
-        $this->log(LogLevel::NOTICE, $message, $context);
-    }
-
-    /**
-     * Interesting events.
-     *
-     * Example: User logs in, SQL logs.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function info($message, array $context = array())
-    {
-        $this->log(LogLevel::INFO, $message, $context);
-    }
-
-    /**
-     * Detailed debug information.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function debug($message, array $context = array())
-    {
-        $this->log(LogLevel::DEBUG, $message, $context);
-    }
-}

+ 0 - 7
frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/InvalidArgumentException.php

@@ -1,7 +0,0 @@
-<?php
-
-namespace Psr\Log;
-
-class InvalidArgumentException extends \InvalidArgumentException
-{
-}

+ 0 - 18
frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/LogLevel.php

@@ -1,18 +0,0 @@
-<?php
-
-namespace Psr\Log;
-
-/**
- * Describes log levels
- */
-class LogLevel
-{
-    const EMERGENCY = 'emergency';
-    const ALERT = 'alert';
-    const CRITICAL = 'critical';
-    const ERROR = 'error';
-    const WARNING = 'warning';
-    const NOTICE = 'notice';
-    const INFO = 'info';
-    const DEBUG = 'debug';
-}

+ 0 - 17
frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/LoggerAwareInterface.php

@@ -1,17 +0,0 @@
-<?php
-
-namespace Psr\Log;
-
-/**
- * Describes a logger-aware instance
- */
-interface LoggerAwareInterface
-{
-    /**
-     * Sets a logger instance on the object
-     *
-     * @param LoggerInterface $logger
-     * @return null
-     */
-    public function setLogger(LoggerInterface $logger);
-}

+ 0 - 22
frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/LoggerAwareTrait.php

@@ -1,22 +0,0 @@
-<?php
-
-namespace Psr\Log;
-
-/**
- * Basic Implementation of LoggerAwareInterface.
- */
-trait LoggerAwareTrait
-{
-    /** @var LoggerInterface */
-    protected $logger;
-
-    /**
-     * Sets a logger.
-     * 
-     * @param LoggerInterface $logger
-     */
-    public function setLogger(LoggerInterface $logger)
-    {
-        $this->logger = $logger;
-    }
-}

+ 0 - 114
frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/LoggerInterface.php

@@ -1,114 +0,0 @@
-<?php
-
-namespace Psr\Log;
-
-/**
- * Describes a logger instance
- *
- * The message MUST be a string or object implementing __toString().
- *
- * The message MAY contain placeholders in the form: {foo} where foo
- * will be replaced by the context data in key "foo".
- *
- * The context array can contain arbitrary data, the only assumption that
- * can be made by implementors is that if an Exception instance is given
- * to produce a stack trace, it MUST be in a key named "exception".
- *
- * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
- * for the full interface specification.
- */
-interface LoggerInterface
-{
-    /**
-     * System is unusable.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function emergency($message, array $context = array());
-
-    /**
-     * Action must be taken immediately.
-     *
-     * Example: Entire website down, database unavailable, etc. This should
-     * trigger the SMS alerts and wake you up.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function alert($message, array $context = array());
-
-    /**
-     * Critical conditions.
-     *
-     * Example: Application component unavailable, unexpected exception.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function critical($message, array $context = array());
-
-    /**
-     * Runtime errors that do not require immediate action but should typically
-     * be logged and monitored.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function error($message, array $context = array());
-
-    /**
-     * Exceptional occurrences that are not errors.
-     *
-     * Example: Use of deprecated APIs, poor use of an API, undesirable things
-     * that are not necessarily wrong.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function warning($message, array $context = array());
-
-    /**
-     * Normal but significant events.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function notice($message, array $context = array());
-
-    /**
-     * Interesting events.
-     *
-     * Example: User logs in, SQL logs.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function info($message, array $context = array());
-
-    /**
-     * Detailed debug information.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function debug($message, array $context = array());
-
-    /**
-     * Logs with an arbitrary level.
-     *
-     * @param mixed $level
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function log($level, $message, array $context = array());
-}

+ 0 - 131
frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/LoggerTrait.php

@@ -1,131 +0,0 @@
-<?php
-
-namespace Psr\Log;
-
-/**
- * This is a simple Logger trait that classes unable to extend AbstractLogger
- * (because they extend another class, etc) can include.
- *
- * It simply delegates all log-level-specific methods to the `log` method to 
- * reduce boilerplate code that a simple Logger that does the same thing with 
- * messages regardless of the error level has to implement.
- */
-trait LoggerTrait
-{
-    /**
-     * System is unusable.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function emergency($message, array $context = array())
-    {
-        $this->log(LogLevel::EMERGENCY, $message, $context);
-    }
-
-    /**
-     * Action must be taken immediately.
-     *
-     * Example: Entire website down, database unavailable, etc. This should
-     * trigger the SMS alerts and wake you up.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function alert($message, array $context = array())
-    {
-        $this->log(LogLevel::ALERT, $message, $context);
-    }
-
-    /**
-     * Critical conditions.
-     *
-     * Example: Application component unavailable, unexpected exception.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function critical($message, array $context = array())
-    {
-        $this->log(LogLevel::CRITICAL, $message, $context);
-    }
-
-    /**
-     * Runtime errors that do not require immediate action but should typically
-     * be logged and monitored.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function error($message, array $context = array())
-    {
-        $this->log(LogLevel::ERROR, $message, $context);
-    }
-
-    /**
-     * Exceptional occurrences that are not errors.
-     *
-     * Example: Use of deprecated APIs, poor use of an API, undesirable things
-     * that are not necessarily wrong.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function warning($message, array $context = array())
-    {
-        $this->log(LogLevel::WARNING, $message, $context);
-    }
-
-    /**
-     * Normal but significant events.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function notice($message, array $context = array())
-    {
-        $this->log(LogLevel::NOTICE, $message, $context);
-    }
-
-    /**
-     * Interesting events.
-     *
-     * Example: User logs in, SQL logs.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function info($message, array $context = array())
-    {
-        $this->log(LogLevel::INFO, $message, $context);
-    }
-
-    /**
-     * Detailed debug information.
-     *
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function debug($message, array $context = array())
-    {
-        $this->log(LogLevel::DEBUG, $message, $context);
-    }
-
-    /**
-     * Logs with an arbitrary level.
-     *
-     * @param mixed $level
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    abstract public function log($level, $message, array $context = array());
-}

+ 0 - 27
frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/NullLogger.php

@@ -1,27 +0,0 @@
-<?php
-
-namespace Psr\Log;
-
-/**
- * This Logger can be used to avoid conditional log calls
- *
- * Logging should always be optional, and if no logger is provided to your
- * library creating a NullLogger instance to have something to throw logs at
- * is a good way to avoid littering your code with `if ($this->logger) { }`
- * blocks.
- */
-class NullLogger extends AbstractLogger
-{
-    /**
-     * Logs with an arbitrary level.
-     *
-     * @param mixed $level
-     * @param string $message
-     * @param array $context
-     * @return null
-     */
-    public function log($level, $message, array $context = array())
-    {
-        // noop
-    }
-}

+ 0 - 116
frameworks/PHP/php-fuel/fuel/packages/log/Psr/Log/Test/LoggerInterfaceTest.php

@@ -1,116 +0,0 @@
-<?php
-
-namespace Psr\Log\Test;
-
-use Psr\Log\LogLevel;
-
-/**
- * Provides a base test class for ensuring compliance with the LoggerInterface
- *
- * Implementors can extend the class and implement abstract methods to run this as part of their test suite
- */
-abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @return LoggerInterface
-     */
-    abstract function getLogger();
-
-    /**
-     * This must return the log messages in order with a simple formatting: "<LOG LEVEL> <MESSAGE>"
-     *
-     * Example ->error('Foo') would yield "error Foo"
-     *
-     * @return string[]
-     */
-    abstract function getLogs();
-
-    public function testImplements()
-    {
-        $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
-    }
-
-    /**
-     * @dataProvider provideLevelsAndMessages
-     */
-    public function testLogsAtAllLevels($level, $message)
-    {
-        $logger = $this->getLogger();
-        $logger->{$level}($message, array('user' => 'Bob'));
-        $logger->log($level, $message, array('user' => 'Bob'));
-
-        $expected = array(
-            $level.' message of level '.$level.' with context: Bob',
-            $level.' message of level '.$level.' with context: Bob',
-        );
-        $this->assertEquals($expected, $this->getLogs());
-    }
-
-    public function provideLevelsAndMessages()
-    {
-        return array(
-            LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
-            LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
-            LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
-            LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
-            LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
-            LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
-            LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
-            LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
-        );
-    }
-
-    /**
-     * @expectedException Psr\Log\InvalidArgumentException
-     */
-    public function testThrowsOnInvalidLevel()
-    {
-        $logger = $this->getLogger();
-        $logger->log('invalid level', 'Foo');
-    }
-
-    public function testContextReplacement()
-    {
-        $logger = $this->getLogger();
-        $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
-
-        $expected = array('info {Message {nothing} Bob Bar a}');
-        $this->assertEquals($expected, $this->getLogs());
-    }
-
-    public function testObjectCastToString()
-    {
-        $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
-        $dummy->expects($this->once())
-            ->method('__toString')
-            ->will($this->returnValue('DUMMY'));
-
-        $this->getLogger()->warning($dummy);
-    }
-
-    public function testContextCanContainAnything()
-    {
-        $context = array(
-            'bool' => true,
-            'null' => null,
-            'string' => 'Foo',
-            'int' => 0,
-            'float' => 0.5,
-            'nested' => array('with object' => new DummyTest),
-            'object' => new \DateTime,
-            'resource' => fopen('php://memory', 'r'),
-        );
-
-        $this->getLogger()->warning('Crazy context data', $context);
-    }
-
-    public function testContextExceptionKeyCanBeExceptionOrOtherValues()
-    {
-        $this->getLogger()->warning('Random message', array('exception' => 'oops'));
-        $this->getLogger()->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
-    }
-}
-
-class DummyTest
-{
-}

+ 0 - 209
frameworks/PHP/php-fuel/fuel/packages/log/README.mdown

@@ -1,209 +0,0 @@
-Log - FuelPHP logging package
-=============================
-
-This package will backport the logging functionality of FuelPHP v2.0 to v1.5+, and will provide a backward compatible API so
-that any FuelPHP v1.5+ application that uses the Fuel Log class can use the new Monolog package.
-
-Note that FuelPHP will use Monolog directly, so when you're writing Fuel 1.x new applications, use Monolog directly as documented below.
-
-Monolog - Logging for PHP 5.3+ [![Build Status](https://secure.travis-ci.org/Seldaek/monolog.png)](http://travis-ci.org/Seldaek/monolog)
-==============================
-
-Monolog sends your logs to files, sockets, inboxes, databases and various
-web services. See the complete list of handlers below. Special handlers
-allow you to build advanced logging strategies.
-
-This library implements the [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
-interface that you can type-hint against in your own libraries to keep
-a maximum of interoperability. You can also use it in your applications to
-make sure you can always use another compatible logger at a later time.
-
-Usage
------
-
-```php
-<?php
-
-use Monolog\Logger;
-use Monolog\Handler\StreamHandler;
-
-// create a log channel
-$log = new Logger('name');
-$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));
-
-// add records to the log
-$log->addWarning('Foo');
-$log->addError('Bar');
-```
-
-Core Concepts
--------------
-
-Every `Logger` instance has a channel (name) and a stack of handlers. Whenever
-you add a record to the logger, it traverses the handler stack. Each handler
-decides whether it handled fully the record, and if so, the propagation of the
-record ends there.
-
-This allows for flexible logging setups, for example having a `StreamHandler` at
-the bottom of the stack that will log anything to disk, and on top of that add
-a `MailHandler` that will send emails only when an error message is logged.
-Handlers also have a `$bubble` property which defines whether they block the
-record or not if they handled it. In this example, setting the `MailHandler`'s
-`$bubble` argument to true means that all records will propagate to the
-`StreamHandler`, even the errors that are handled by the `MailHandler`.
-
-You can create many `Logger`s, each defining a channel (e.g.: db, request,
-router, ..) and each of them combining various handlers, which can be shared
-or not. The channel is reflected in the logs and allows you to easily see or
-filter records.
-
-Each Handler also has a Formatter, a default one with settings that make sense
-will be created if you don't set one. The formatters normalize and format
-incoming records so that they can be used by the handlers to output useful
-information.
-
-Custom severity levels are not available. Only the eight
-[RFC 5424](http://tools.ietf.org/html/rfc5424) levels (debug, info, notice,
-warning, error, critical, alert, emergency) are present for basic filtering
-purposes, but for sorting and other use cases that would require
-flexibility, you should add Processors to the Logger that can add extra
-information (tags, user ip, ..) to the records before they are handled.
-
-Log Levels
-----------
-
-Monolog supports all 8 logging levels defined in
-[RFC 5424](http://tools.ietf.org/html/rfc5424), but unless you specifically
-need syslog compatibility, it is advised to only use DEBUG, INFO, WARNING,
-ERROR, CRITICAL, ALERT.
-
-- **DEBUG** (100): Detailed debug information.
-
-- **INFO** (200): Interesting events. Examples: User logs in, SQL logs.
-
-- NOTICE (250): Normal but significant events.
-
-- **WARNING** (300): Exceptional occurrences that are not errors. Examples:
-  Use of deprecated APIs, poor use of an API, undesirable things that are not
-  necessarily wrong.
-
-- **ERROR** (400): Runtime errors that do not require immediate action but
-  should typically be logged and monitored.
-
-- **CRITICAL** (500): Critical conditions. Example: Application component
-  unavailable, unexpected exception.
-
-- **ALERT** (550): Action must be taken immediately. Example: Entire website
-  down, database unavailable, etc. This should trigger the SMS alerts and wake
-  you up.
-
-- EMERGENCY (600): Emergency: system is unusable.
-
-Docs
-====
-
-**See the `doc` directory for more detailed documentation.
-The following is only a list of all parts that come with Monolog.**
-
-Handlers
---------
-
-- _StreamHandler_: Logs records into any PHP stream, use this for log files.
-- _RotatingFileHandler_: Logs records to a file and creates one logfile per day.
-  It will also delete files older than `$maxFiles`. You should use
-  [logrotate](http://linuxcommand.org/man_pages/logrotate8.html) for high profile
-  setups though, this is just meant as a quick and dirty solution.
-- _FirePHPHandler_: Handler for [FirePHP](http://www.firephp.org/), providing
-  inline `console` messages within [FireBug](http://getfirebug.com/).
-- _ChromePHPHandler_: Handler for [ChromePHP](http://www.chromephp.com/), providing
-  inline `console` messages within Chrome.
-- _MongoDBHandler_: Handler to write records in MongoDB via a
-  [Mongo](http://pecl.php.net/package/mongo) extension connection.
-- _NativeMailHandler_: Sends emails using PHP's
-  [`mail()`](http://php.net/manual/en/function.mail.php) function.
-- _SwiftMailerHandler_: Sends emails using a [`Swift_Mailer`](http://swiftmailer.org/) instance.
-- _PushoverHandler_: Sends mobile notifications via the [Pushover](https://www.pushover.net/) API.
-- _SyslogHandler_: Logs records to the syslog.
-- _GelfHandler_: Logs records to a [Graylog2](http://www.graylog2.org) server.
-- _SocketHandler_: Logs records to [sockets](http://php.net/fsockopen), use this
-  for UNIX and TCP sockets. See an [example](https://github.com/Seldaek/monolog/blob/master/doc/sockets.md).
-- _AmqpHandler_: Logs records to an [amqp](http://www.amqp.org/) compatible
-  server. Requires the [php-amqp](http://pecl.php.net/package/amqp) extension (1.0+).
-- _CubeHandler_: Logs records to a [Cube](http://square.github.com/cube/) server.
-- _CouchDBHandler_: Logs records to a CouchDB server.
-- _DoctrineCouchDBHandler_: Logs records to a CouchDB server via the Doctrine CouchDB ODM.
-- _RavenHandler_: Logs records to a [Sentry](http://getsentry.com/) server using
-  [raven](https://packagist.org/packages/raven/raven).
-
-Wrappers / Special Handlers
----------------------------
-
-- _FingersCrossedHandler_: A very interesting wrapper. It takes a logger as
-  parameter and will accumulate log records of all levels until a record
-  exceeds the defined severity level. At which point it delivers all records,
-  including those of lower severity, to the handler it wraps. This means that
-  until an error actually happens you will not see anything in your logs, but
-  when it happens you will have the full information, including debug and info
-  records. This provides you with all the information you need, but only when
-  you need it.
-- _NullHandler_: Any record it can handle will be thrown away. This can be used
-  to put on top of an existing handler stack to disable it temporarily.
-- _BufferHandler_: This handler will buffer all the log records it receives
-  until `close()` is called at which point it will call `handleBatch()` on the
-  handler it wraps with all the log messages at once. This is very useful to
-  send an email with all records at once for example instead of having one mail
-  for every log record.
-- _GroupHandler_: This handler groups other handlers. Every record received is
-  sent to all the handlers it is configured with.
-- _TestHandler_: Used for testing, it records everything that is sent to it and
-  has accessors to read out the information.
-
-Formatters
-----------
-
-- _LineFormatter_: Formats a log record into a one-line string.
-- _NormalizerFormatter_: Normalizes objects/resources down to strings so a record can easily be serialized/encoded.
-- _JsonFormatter_: Encodes a log record into json.
-- _WildfireFormatter_: Used to format log records into the Wildfire/FirePHP protocol, only useful for the FirePHPHandler.
-- _ChromePHPFormatter_: Used to format log records into the ChromePHP format, only useful for the ChromePHPHandler.
-- _GelfFormatter_: Used to format log records into Gelf message instances, only useful for the GelfHandler.
-- _LogstashFormatter_: Used to format log records into [logstash](http://logstash.net/) event json, useful for any handler listed under inputs [here](http://logstash.net/docs/1.1.5/).
-
-Processors
-----------
-
-- _IntrospectionProcessor_: Adds the line/file/class/method from which the log call originated.
-- _WebProcessor_: Adds the current request URI, request method and client IP to a log record.
-- _MemoryUsageProcessor_: Adds the current memory usage to a log record.
-- _MemoryPeakUsageProcessor_: Adds the peak memory usage to a log record.
-
-About
-=====
-
-Requirements
-------------
-
-- Any flavor of PHP 5.3 or above should do
-- [optional] PHPUnit 3.5+ to execute the test suite (phpunit --version)
-
-Submitting bugs and feature requests
-------------------------------------
-
-Bugs and feature request are tracked on [GitHub](https://github.com/Seldaek/monolog/issues)
-
-Author
-------
-
-Jordi Boggiano - <[email protected]> - <http://twitter.com/seldaek><br />
-See also the list of [contributors](https://github.com/Seldaek/monolog/contributors) which participated in this project.
-
-License
--------
-
-Monolog is licensed under the MIT License - see the `LICENSE` file for details
-
-Acknowledgements
-----------------
-
-This library is heavily inspired by Python's [Logbook](http://packages.python.org/Logbook/)
-library, although most concepts have been adjusted to fit to the PHP world.

+ 0 - 23
frameworks/PHP/php-fuel/fuel/packages/log/bootstrap.php

@@ -1,23 +0,0 @@
-<?php
-
-/**
- * Alias the Log namespace to global so we can overload the Log class
- */
-Autoloader::add_core_namespace('Log');
-
-/**
- * Inform the autoloader where to find what...
- */
-
-/**
- * v1.x style classes.
- */
-Autoloader::add_classes(array(
-	'Log\\Log'                    => __DIR__.'/classes/log.php',
-));
-
-/**
- * v2.0 style classes. They are PSR-0, so we only need to define the path.
- */
-Autoloader::add_namespace('Psr\\Log', __DIR__.'/Psr/Log/', true);
-Autoloader::add_namespace('Monolog', __DIR__.'/src/Monolog/', true);

+ 0 - 217
frameworks/PHP/php-fuel/fuel/packages/log/classes/log.php

@@ -1,217 +0,0 @@
-<?php
-/**
- * Fuel is a fast, lightweight, community driven PHP5 framework.
- *
- * @package    Fuel
- * @version    1.0
- * @author     Fuel Development Team
- * @license    MIT License
- * @copyright  2010 - 2013 Fuel Development Team
- * @link       http://fuelphp.com
- */
-
-namespace Log;
-
-/**
- * Log core class replacement
- *
- * This class will provide the interface between the Fuel v1.x class API
- * and the Monolog package, in preparation for FuelPHP v2.0
- */
-class Log
-{
-	/**
-	 * container for the Monolog instance
-	 */
-	protected static $monolog = null;
-
-	/**
-	 * Copy of the Monolog log levels
-	 */
-	protected static $levels = array(
-		100 => 'DEBUG',
-		200 => 'INFO',
-		250 => 'NOTICE',
-		300 => 'WARNING',
-		400 => 'ERROR',
-		500 => 'CRITICAL',
-		550 => 'ALERT',
-		600 => 'EMERGENCY',
-	);
-
-	/**
-	 * Initialize the class
-	 */
-	public static function _init()
-	{
-		// load the file config
-		\Config::load('file', true);
-
-		// determine the name and location of the logfile
-		$filepath = \Config::get('log_path').date('Y/m').'/';
-
-		if ( ! is_dir($filepath))
-		{
-			@mkdir($filepath, \Config::get('file.chmod.folders', 0777), true);
-		}
-
-		$filename = $filepath.date('d').'.php';
-
-		if ( ! $handle = @fopen($filename, 'a'))
-		{
-			die('Fatal error: could not create or access the log file ('.$filename.')<br />check your file system permissions!');
-		}
-
-		if ( ! filesize($filename))
-		{
-			fwrite($handle, "<?php defined('COREPATH') or exit('No direct script access allowed'); ?>".PHP_EOL.PHP_EOL);
-			chmod($filename, \Config::get('file.chmod.files', 0666));
-		}
-		fclose($handle);
-
-		// create the monolog instance
-		static::$monolog = new \Monolog\Logger('fuelphp');
-
-		// create the streamhandler, and activate the handler
-		$stream = new \Monolog\Handler\StreamHandler($filename, \Monolog\Logger::DEBUG);
-		$formatter = new \Monolog\Formatter\LineFormatter("%level_name% - %datetime% --> %message%".PHP_EOL, "Y-m-d H:i:s");
-		$stream->setFormatter($formatter);
-		static::$monolog->pushHandler($stream);
-	}
-
-	/**
-	 * Return the monolog instance
-	 */
-	public static function instance()
-	{
-		return static::$monolog;
-	}
-
-	/**
-	 * Logs a message with the Info Log Level
-	 *
-	 * @param   string  $msg     The log message
-	 * @param   string  $method  The method that logged
-	 * @return  bool    If it was successfully logged
-	 */
-	public static function info($msg, $method = null)
-	{
-		return static::write(\Fuel::L_INFO, $msg, $method);
-	}
-
-	/**
-	 * Logs a message with the Debug Log Level
-	 *
-	 * @param   string  $msg     The log message
-	 * @param   string  $method  The method that logged
-	 * @return  bool    If it was successfully logged
-	 */
-	public static function debug($msg, $method = null)
-	{
-		return static::write(\Fuel::L_DEBUG, $msg, $method);
-	}
-
-	/**
-	 * Logs a message with the Warning Log Level
-	 *
-	 * @param   string  $msg     The log message
-	 * @param   string  $method  The method that logged
-	 * @return  bool    If it was successfully logged
-	 */
-	public static function warning($msg, $method = null)
-	{
-		return static::write(\Fuel::L_WARNING, $msg, $method);
-	}
-
-	/**
-	 * Logs a message with the Error Log Level
-	 *
-	 * @param   string  $msg     The log message
-	 * @param   string  $method  The method that logged
-	 * @return  bool    If it was successfully logged
-	 */
-	public static function error($msg, $method = null)
-	{
-		return static::write(\Fuel::L_ERROR, $msg, $method);
-	}
-
-
-	/**
-	 * Write Log File
-	 *
-	 * Generally this function will be called using the global log_message() function
-	 *
-	 * @access	public
-	 * @param	int|string	the error level
-	 * @param	string	the error message
-	 * @param	string	information about the method
-	 * @return	bool
-	 */
-	public static function write($level, $msg, $method = null)
-	{
-		// defined default error labels
-		static $oldlabels = array(
-			1  => 'Error',
-			2  => 'Warning',
-			3  => 'Debug',
-			4  => 'Info',
-		);
-
-		// get the levels defined to be logged
-		$loglabels = \Config::get('log_threshold');
-
-		// bail out if we don't need logging at all
-		if ($loglabels == \Fuel::L_NONE)
-		{
-			return false;
-		}
-
-		// if it's not an array, assume it's an "up to" level
-		if ( ! is_array($loglabels))
-		{
-			$a = array();
-			foreach (static::$levels as $l => $label)
-			{
-				$l >= $loglabels and $a[] = $l;
-			}
-			$loglabels = $a;
-		}
-
-		// if profiling is active log the message to the profile
-		if (\Config::get('profiling'))
-		{
-			\Console::log($method.' - '.$msg);
-		}
-
-		// convert the level to monolog standards if needed
-		if (is_int($level) and isset($oldlabels[$level]))
-		{
-			$level = strtoupper($oldlabels[$level]);
-		}
-		if (is_string($level))
-		{
-			if ( ! $level = array_search($level, static::$levels))
-			{
-				$level = 250;	// can't map it, convert it to a NOTICE
-			}
-		}
-
-		// make sure $level has the correct value
-		if ((is_int($level) and ! isset(static::$levels[$level])) or (is_string($level) and ! array_search(strtoupper($level), static::$levels)))
-		{
-			throw new \FuelException('Invalid level "'.$level.'" passed to logger()');
-		}
-
-		// do we need to log the message with this level?
-		if ( ! in_array($level, $loglabels))
-		{
-			return false;
-		}
-
-		// log the message
-		static::$monolog->log($level, (empty($method) ? '' : $method.' - ').$msg);
-
-		return true;
-	}
-
-}

+ 0 - 76
frameworks/PHP/php-fuel/fuel/packages/log/doc/extending.md

@@ -1,76 +0,0 @@
-Extending Monolog
-=================
-
-Monolog is fully extensible, allowing you to adapt your logger to your needs.
-
-Writing your own handler
-------------------------
-
-Monolog provides many built-in handlers. But if the one you need does not
-exist, you can write it and use it in your logger. The only requirement is
-to implement `Monolog\Handler\HandlerInterface`.
-
-Let's write a PDOHandler to log records to a database. We will extend the
-abstract class provided by Monolog to keep things DRY.
-
-```php
-<?php
-
-use Monolog\Logger;
-use Monolog\Handler\AbstractProcessingHandler;
-
-class PDOHandler extends AbstractProcessingHandler
-{
-    private $initialized = false;
-    private $pdo;
-    private $statement;
-
-    public function __construct(PDO $pdo, $level = Logger::DEBUG, $bubble = true)
-    {
-        $this->pdo = $pdo;
-        parent::__construct($level, $bubble);
-    }
-
-    protected function write(array $record)
-    {
-        if (!$this->initialized) {
-            $this->initialize();
-        }
-
-        $this->statement->execute(array(
-            'channel' => $record['channel'],
-            'level' => $record['level'],
-            'message' => $record['formatted'],
-            'time' => $record['datetime']->format('U'),
-        ));
-    }
-
-    private function initialize()
-    {
-        $this->pdo->exec(
-            'CREATE TABLE IF NOT EXISTS monolog '
-            .'(channel VARCHAR(255), level INTEGER, message LONGTEXT, time INTEGER UNSIGNED)'
-        );
-        $this->statement = $this->pdo->prepare(
-            'INSERT INTO monolog (channel, level, message, time) VALUES (:channel, :level, :message, :time)'
-        );
-
-        $this->initialized = true;
-    }
-}
-```
-
-You can now use this handler in your logger:
-
-```php
-<?php
-
-$logger->pushHandler(new PDOHandler(new PDO('sqlite:logs.sqlite'));
-
-// You can now use your logger
-$logger->addInfo('My logger is now ready');
-```
-
-The `Monolog\Handler\AbstractProcessingHandler` class provides most of the
-logic needed for the handler, including the use of processors and the formatting
-of the record (which is why we use ``$record['formatted']`` instead of ``$record['message']``).

+ 0 - 37
frameworks/PHP/php-fuel/fuel/packages/log/doc/sockets.md

@@ -1,37 +0,0 @@
-Sockets Handler
-===============
-
-This handler allows you to write your logs to sockets using [fsockopen](http://php.net/fsockopen)
-or [pfsockopen](http://php.net/pfsockopen).
-
-Persistent sockets are mainly useful in web environments where you gain some performance not closing/opening
-the connections between requests.
-
-Basic Example
--------------
-
-```php
-<?php
-
-use Monolog\Logger;
-use Monolog\Handler\SocketHandler;
-
-// Create the logger
-$logger = new Logger('my_logger');
-
-// Create the handler
-$handler = new SocketHandler('unix:///var/log/httpd_app_log.socket');
-$handler->setPersistent(true);
-
-// Now add the handler
-$logger->pushHandler($handler, Logger::DEBUG);
-
-// You can now use your logger
-$logger->addInfo('My logger is now ready');
-
-```
-
-In this example, using syslog-ng, you should see the log on the log server:
-
-    cweb1 [2012-02-26 00:12:03] my_logger.INFO: My logger is now ready [] []
-

+ 0 - 158
frameworks/PHP/php-fuel/fuel/packages/log/doc/usage.md

@@ -1,158 +0,0 @@
-Using Monolog
-=============
-
-Installation
-------------
-
-Monolog is available on Packagist ([monolog/monolog](http://packagist.org/packages/monolog/monolog))
-and as such installable via [Composer](http://getcomposer.org/).
-
-If you do not use Composer, you can grab the code from GitHub, and use any
-PSR-0 compatible autoloader (e.g. the [Symfony2 ClassLoader component](https://github.com/symfony/ClassLoader))
-to load Monolog classes.
-
-Configuring a logger
---------------------
-
-Here is a basic setup to log to a file and to firephp on the DEBUG level:
-
-```php
-<?php
-
-use Monolog\Logger;
-use Monolog\Handler\StreamHandler;
-use Monolog\Handler\FirePHPHandler;
-
-// Create the logger
-$logger = new Logger('my_logger');
-// Now add some handlers
-$logger->pushHandler(new StreamHandler(__DIR__.'/my_app.log', Logger::DEBUG));
-$logger->pushHandler(new FirePHPHandler());
-
-// You can now use your logger
-$logger->addInfo('My logger is now ready');
-```
-
-Let's explain it. The first step is to create the logger instance which will
-be used in your code. The argument is a channel name, which is useful when
-you use several loggers (see below for more details about it).
-
-The logger itself does not know how to handle a record. It delegates it to
-some handlers. The code above registers two handlers in the stack to allow
-handling records in two different ways.
-
-Note that the FirePHPHandler is called first as it is added on top of the
-stack. This allows you to temporarily add a logger with bubbling disabled if
-you want to override other configured loggers.
-
-Adding extra data in the records
---------------------------------
-
-Monolog provides two different ways to add extra informations along the simple
-textual message.
-
-### Using the logging context
-
-The first way is the context, allowing to pass an array of data along the
-record:
-
-```php
-<?php
-
-$logger->addInfo('Adding a new user', array('username' => 'Seldaek'));
-```
-
-Simple handlers (like the StreamHandler for instance) will simply format
-the array to a string but richer handlers can take advantage of the context
-(FirePHP is able to display arrays in pretty way for instance).
-
-### Using processors
-
-The second way is to add extra data for all records by using a processor.
-Processors can be any callable. They will get the record as parameter and
-must return it after having eventually changed the `extra` part of it. Let's
-write a processor adding some dummy data in the record:
-
-```php
-<?php
-
-$logger->pushProcessor(function ($record) {
-    $record['extra']['dummy'] = 'Hello world!';
-
-    return $record;
-});
-```
-
-Monolog provides some built-in processors that can be used in your project.
-Look at the README file for the list.
-
-> Tip: processors can also be registered on a specific handler instead of
-  the logger to apply only for this handler.
-
-Leveraging channels
--------------------
-
-Channels are a great way to identify to which part of the application a record
-is related. This is useful in big applications (and is leveraged by
-MonologBundle in Symfony2).
-
-Picture two loggers sharing a handler that writes to a single log file.
-Channels would allow you to identify the logger that issued every record.
-You can easily grep through the log files filtering this or that channel.
-
-```php
-<?php
-
-use Monolog\Logger;
-use Monolog\Handler\StreamHandler;
-use Monolog\Handler\FirePHPHandler;
-
-// Create some handlers
-$stream = new StreamHandler(__DIR__.'/my_app.log', Logger::DEBUG);
-$firephp = new FirePHPHandler();
-
-// Create the main logger of the app
-$logger = new Logger('my_logger');
-$logger->pushHandler($stream);
-$logger->pushHandler($firephp);
-
-// Create a logger for the security-related stuff with a different channel
-$securityLogger = new Logger('security');
-$securityLogger->pushHandler($stream);
-$securityLogger->pushHandler($firephp);
-```
-
-Customizing log format
-----------------------
-
-In Monolog it's easy to customize the format of the logs written into files,
-sockets, mails, databases and other handlers. Most of the handlers use the
-
-```php
-$record['formatted']
-```
-
-value to be automatically put into the log device. This value depends on the
-formatter settings. You can choose between predefined formatter classes or
-write your own (e.g. a multiline text file for human-readable output).
-
-To configure a predefined formatter class, just set it as the handler's field:
-
-```php
-// the default date format is "Y-m-d H:i:s"
-$dateFormat = "Y n j, g:i a";
-// the default output format is "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"
-$output = "%datetime% > %level_name% > %message% %context% %extra%\n";
-// finally, create a formatter
-$formatter = new LineFormatter($output, $dateFormat);
-
-// Create a handler
-$stream = new StreamHandler(__DIR__.'/my_app.log', Logger::DEBUG);
-$stream->setFormatter($formatter);
-// bind it to a logger object
-$securityLogger = new Logger('security');
-$securityLogger->pushHandler($stream);
-```
-
-You may also reuse the same formatter between multiple handlers and share those
-handlers between multiple loggers.

+ 0 - 79
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/ChromePHPFormatter.php

@@ -1,79 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Formatter;
-
-use Monolog\Logger;
-
-/**
- * Formats a log message according to the ChromePHP array format
- *
- * @author Christophe Coevoet <[email protected]>
- */
-class ChromePHPFormatter implements FormatterInterface
-{
-    /**
-     * Translates Monolog log levels to Wildfire levels.
-     */
-    private $logLevels = array(
-        Logger::DEBUG     => 'log',
-        Logger::INFO      => 'info',
-        Logger::NOTICE    => 'info',
-        Logger::WARNING   => 'warn',
-        Logger::ERROR     => 'error',
-        Logger::CRITICAL  => 'error',
-        Logger::ALERT     => 'error',
-        Logger::EMERGENCY => 'error',
-    );
-
-    /**
-     * {@inheritdoc}
-     */
-    public function format(array $record)
-    {
-        // Retrieve the line and file if set and remove them from the formatted extra
-        $backtrace = 'unknown';
-        if (isset($record['extra']['file']) && isset($record['extra']['line'])) {
-            $backtrace = $record['extra']['file'].' : '.$record['extra']['line'];
-            unset($record['extra']['file']);
-            unset($record['extra']['line']);
-        }
-
-        $message = array('message' => $record['message']);
-        if ($record['context']) {
-            $message['context'] = $record['context'];
-        }
-        if ($record['extra']) {
-            $message['extra'] = $record['extra'];
-        }
-        if (count($message) === 1) {
-            $message = reset($message);
-        }
-
-        return array(
-            $record['channel'],
-            $message,
-            $backtrace,
-            $this->logLevels[$record['level']],
-        );
-    }
-
-    public function formatBatch(array $records)
-    {
-        $formatted = array();
-
-        foreach ($records as $record) {
-            $formatted[] = $this->format($record);
-        }
-
-        return $formatted;
-    }
-}

+ 0 - 36
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/FormatterInterface.php

@@ -1,36 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Formatter;
-
-/**
- * Interface for formatters
- *
- * @author Jordi Boggiano <[email protected]>
- */
-interface FormatterInterface
-{
-    /**
-     * Formats a log record.
-     *
-     * @param  array $record A record to format
-     * @return mixed The formatted record
-     */
-    public function format(array $record);
-
-    /**
-     * Formats a set of log records.
-     *
-     * @param  array $records A set of records to format
-     * @return mixed The formatted set of records
-     */
-    public function formatBatch(array $records);
-}

+ 0 - 94
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/GelfMessageFormatter.php

@@ -1,94 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Formatter;
-
-use Monolog\Logger;
-use Gelf\Message;
-
-/**
- * Serializes a log message to GELF
- * @see http://www.graylog2.org/about/gelf
- *
- * @author Matt Lehner <[email protected]>
- */
-class GelfMessageFormatter extends NormalizerFormatter
-{
-    /**
-     * @var string the name of the system for the Gelf log message
-     */
-    protected $systemName;
-
-    /**
-     * @var string a prefix for 'extra' fields from the Monolog record (optional)
-     */
-    protected $extraPrefix;
-
-    /**
-     * @var string a prefix for 'context' fields from the Monolog record (optional)
-     */
-    protected $contextPrefix;
-
-    /**
-     * Translates Monolog log levels to Graylog2 log priorities.
-     */
-    private $logLevels = array(
-        Logger::DEBUG     => 7,
-        Logger::INFO      => 6,
-        Logger::NOTICE    => 5,
-        Logger::WARNING   => 4,
-        Logger::ERROR     => 3,
-        Logger::CRITICAL  => 2,
-        Logger::ALERT     => 1,
-        Logger::EMERGENCY => 0,
-    );
-
-    public function __construct($systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_')
-    {
-        parent::__construct('U.u');
-
-        $this->systemName = $systemName ?: gethostname();
-
-        $this->extraPrefix = $extraPrefix;
-        $this->contextPrefix = $contextPrefix;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function format(array $record)
-    {
-        $record = parent::format($record);
-        $message = new Message();
-        $message
-            ->setTimestamp($record['datetime'])
-            ->setShortMessage((string) $record['message'])
-            ->setFacility($record['channel'])
-            ->setHost($this->systemName)
-            ->setLine(isset($record['extra']['line']) ? $record['extra']['line'] : null)
-            ->setFile(isset($record['extra']['file']) ? $record['extra']['file'] : null)
-            ->setLevel($this->logLevels[$record['level']]);
-
-        // Do not duplicate these values in the additional fields
-        unset($record['extra']['line']);
-        unset($record['extra']['file']);
-
-        foreach ($record['extra'] as $key => $val) {
-            $message->setAdditional($this->extraPrefix . $key, is_scalar($val) ? $val : $this->toJson($val));
-        }
-
-        foreach ($record['context'] as $key => $val) {
-            $message->setAdditional($this->contextPrefix . $key, is_scalar($val) ? $val : $this->toJson($val));
-        }
-
-        return $message;
-    }
-}

+ 0 - 38
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/JsonFormatter.php

@@ -1,38 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Formatter;
-
-/**
- * Encodes whatever record data is passed to it as json
- *
- * This can be useful to log to databases or remote APIs
- *
- * @author Jordi Boggiano <[email protected]>
- */
-class JsonFormatter implements FormatterInterface
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function format(array $record)
-    {
-        return json_encode($record);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function formatBatch(array $records)
-    {
-        return json_encode($records);
-    }
-}

+ 0 - 91
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/LineFormatter.php

@@ -1,91 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Formatter;
-
-/**
- * Formats incoming records into a one-line string
- *
- * This is especially useful for logging to files
- *
- * @author Jordi Boggiano <[email protected]>
- * @author Christophe Coevoet <[email protected]>
- */
-class LineFormatter extends NormalizerFormatter
-{
-    const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n";
-
-    protected $format;
-
-    /**
-     * @param string $format     The format of the message
-     * @param string $dateFormat The format of the timestamp: one supported by DateTime::format
-     */
-    public function __construct($format = null, $dateFormat = null)
-    {
-        $this->format = $format ?: static::SIMPLE_FORMAT;
-        parent::__construct($dateFormat);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function format(array $record)
-    {
-        $vars = parent::format($record);
-
-        $output = $this->format;
-        foreach ($vars['extra'] as $var => $val) {
-            if (false !== strpos($output, '%extra.'.$var.'%')) {
-                $output = str_replace('%extra.'.$var.'%', $this->convertToString($val), $output);
-                unset($vars['extra'][$var]);
-            }
-        }
-        foreach ($vars as $var => $val) {
-            $output = str_replace('%'.$var.'%', $this->convertToString($val), $output);
-        }
-
-        return $output;
-    }
-
-    public function formatBatch(array $records)
-    {
-        $message = '';
-        foreach ($records as $record) {
-            $message .= $this->format($record);
-        }
-
-        return $message;
-    }
-
-    protected function normalize($data)
-    {
-        if (is_bool($data) || is_null($data)) {
-            return var_export($data, true);
-        }
-
-        return parent::normalize($data);
-    }
-
-    protected function convertToString($data)
-    {
-        if (null === $data || is_scalar($data)) {
-            return (string) $data;
-        }
-
-        $data = $this->normalize($data);
-        if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
-            return $this->toJson($data);
-        }
-
-        return str_replace('\\/', '/', json_encode($data));
-    }
-}

+ 0 - 98
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/LogstashFormatter.php

@@ -1,98 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Formatter;
-
-/**
- * Serializes a log message to Logstash Event Format
- *
- * @see http://logstash.net/
- * @see https://github.com/logstash/logstash/blob/master/lib/logstash/event.rb
- *
- * @author Tim Mower <[email protected]>
- */
-class LogstashFormatter extends NormalizerFormatter
-{
-    /**
-     * @var string the name of the system for the Logstash log message, used to fill the @source field
-     */
-    protected $systemName;
-
-    /**
-     * @var string an application name for the Logstash log message, used to fill the @type field
-     */
-    protected $applicationName;
-
-    /**
-     * @var string a prefix for 'extra' fields from the Monolog record (optional)
-     */
-    protected $extraPrefix;
-
-    /**
-     * @var string a prefix for 'context' fields from the Monolog record (optional)
-     */
-    protected $contextPrefix;
-
-    /**
-     * @param string $applicationName the application that sends the data, used as the "type" field of logstash
-     * @param string $systemName      the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine
-     * @param string $extraPrefix     prefix for extra keys inside logstash "fields"
-     * @param string $contextPrefix   prefix for context keys inside logstash "fields", defaults to ctxt_
-     */
-    public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_')
-    {
-        //log stash requires a ISO 8601 format date
-        parent::__construct('c');
-
-        $this->systemName = $systemName ?: gethostname();
-        $this->applicationName = $applicationName;
-
-        $this->extraPrefix = $extraPrefix;
-        $this->contextPrefix = $contextPrefix;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function format(array $record)
-    {
-        $record = parent::format($record);
-        $message = array(
-            '@timestamp' => $record['datetime'],
-            '@message' => $record['message'],
-            '@tags' => array($record['channel']),
-            '@source' => $this->systemName
-        );
-
-        if ($this->applicationName) {
-            $message['@type'] = $this->applicationName;
-        }
-        $message['@fields'] = array();
-        $message['@fields']['channel'] = $record['channel'];
-        $message['@fields']['level'] = $record['level'];
-
-        if (isset($record['extra']['server'])) {
-            $message['@source_host'] = $record['extra']['server'];
-        }
-        if (isset($record['extra']['url'])) {
-            $message['@source_path'] = $record['extra']['url'];
-        }
-        foreach ($record['extra'] as $key => $val) {
-            $message['@fields'][$this->extraPrefix . $key] = $val;
-        }
-
-        foreach ($record['context'] as $key => $val) {
-            $message['@fields'][$this->contextPrefix . $key] = $val;
-        }
-
-        return json_encode($message) . "\n";
-    }
-}

+ 0 - 101
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/NormalizerFormatter.php

@@ -1,101 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Formatter;
-
-/**
- * Normalizes incoming records to remove objects/resources so it's easier to dump to various targets
- *
- * @author Jordi Boggiano <[email protected]>
- */
-class NormalizerFormatter implements FormatterInterface
-{
-    const SIMPLE_DATE = "Y-m-d H:i:s";
-
-    protected $dateFormat;
-
-    /**
-     * @param string $dateFormat The format of the timestamp: one supported by DateTime::format
-     */
-    public function __construct($dateFormat = null)
-    {
-        $this->dateFormat = $dateFormat ?: static::SIMPLE_DATE;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function format(array $record)
-    {
-        return $this->normalize($record);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function formatBatch(array $records)
-    {
-        foreach ($records as $key => $record) {
-            $records[$key] = $this->format($record);
-        }
-
-        return $records;
-    }
-
-    protected function normalize($data)
-    {
-        if (null === $data || is_scalar($data)) {
-            return $data;
-        }
-
-        if (is_array($data) || $data instanceof \Traversable) {
-            $normalized = array();
-
-            foreach ($data as $key => $value) {
-                $normalized[$key] = $this->normalize($value);
-            }
-
-            return $normalized;
-        }
-
-        if ($data instanceof \DateTime) {
-            return $data->format($this->dateFormat);
-        }
-
-        if (is_object($data)) {
-            return sprintf("[object] (%s: %s)", get_class($data), $this->toJson($data, true));
-        }
-
-        if (is_resource($data)) {
-            return '[resource]';
-        }
-
-        return '[unknown('.gettype($data).')]';
-    }
-
-    protected function toJson($data, $ignoreErrors = false)
-    {
-        // suppress json_encode errors since it's twitchy with some inputs
-        if ($ignoreErrors) {
-            if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
-                return @json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
-            }
-
-            return @json_encode($data);
-        }
-
-        if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
-            return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
-        }
-
-        return json_encode($data);
-    }
-}

+ 0 - 102
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Formatter/WildfireFormatter.php

@@ -1,102 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Formatter;
-
-use Monolog\Logger;
-
-/**
- * Serializes a log message according to Wildfire's header requirements
- *
- * @author Eric Clemmons (@ericclemmons) <[email protected]>
- * @author Christophe Coevoet <[email protected]>
- * @author Kirill chEbba Chebunin <[email protected]>
- */
-class WildfireFormatter extends NormalizerFormatter
-{
-    /**
-     * Translates Monolog log levels to Wildfire levels.
-     */
-    private $logLevels = array(
-        Logger::DEBUG     => 'LOG',
-        Logger::INFO      => 'INFO',
-        Logger::NOTICE    => 'INFO',
-        Logger::WARNING   => 'WARN',
-        Logger::ERROR     => 'ERROR',
-        Logger::CRITICAL  => 'ERROR',
-        Logger::ALERT     => 'ERROR',
-        Logger::EMERGENCY => 'ERROR',
-    );
-
-    /**
-     * {@inheritdoc}
-     */
-    public function format(array $record)
-    {
-        // Retrieve the line and file if set and remove them from the formatted extra
-        $file = $line = '';
-        if (isset($record['extra']['file'])) {
-            $file = $record['extra']['file'];
-            unset($record['extra']['file']);
-        }
-        if (isset($record['extra']['line'])) {
-            $line = $record['extra']['line'];
-            unset($record['extra']['line']);
-        }
-
-        $record = $this->normalize($record);
-        $message = array('message' => $record['message']);
-        $handleError = false;
-        if ($record['context']) {
-            $message['context'] = $record['context'];
-            $handleError = true;
-        }
-        if ($record['extra']) {
-            $message['extra'] = $record['extra'];
-            $handleError = true;
-        }
-        if (count($message) === 1) {
-            $message = reset($message);
-        }
-
-        // Create JSON object describing the appearance of the message in the console
-        $json = $this->toJson(array(
-            array(
-                'Type'  => $this->logLevels[$record['level']],
-                'File'  => $file,
-                'Line'  => $line,
-                'Label' => $record['channel'],
-            ),
-            $message,
-        ), $handleError);
-
-        // The message itself is a serialization of the above JSON object + it's length
-        return sprintf(
-            '%s|%s|',
-            strlen($json),
-            $json
-        );
-    }
-
-    public function formatBatch(array $records)
-    {
-        throw new \BadMethodCallException('Batch formatting does not make sense for the WildfireFormatter');
-    }
-
-    protected function normalize($data)
-    {
-        if (is_object($data) && !$data instanceof \DateTime) {
-            return $data;
-        }
-
-        return parent::normalize($data);
-    }
-}

+ 0 - 174
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/AbstractHandler.php

@@ -1,174 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-use Monolog\Formatter\FormatterInterface;
-use Monolog\Formatter\LineFormatter;
-
-/**
- * Base Handler class providing the Handler structure
- *
- * @author Jordi Boggiano <[email protected]>
- */
-abstract class AbstractHandler implements HandlerInterface
-{
-    protected $level = Logger::DEBUG;
-    protected $bubble = false;
-
-    /**
-     * @var FormatterInterface
-     */
-    protected $formatter;
-    protected $processors = array();
-
-    /**
-     * @param integer $level  The minimum logging level at which this handler will be triggered
-     * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
-     */
-    public function __construct($level = Logger::DEBUG, $bubble = true)
-    {
-        $this->level = $level;
-        $this->bubble = $bubble;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function isHandling(array $record)
-    {
-        return $record['level'] >= $this->level;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function handleBatch(array $records)
-    {
-        foreach ($records as $record) {
-            $this->handle($record);
-        }
-    }
-
-    /**
-     * Closes the handler.
-     *
-     * This will be called automatically when the object is destroyed
-     */
-    public function close()
-    {
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function pushProcessor($callback)
-    {
-        if (!is_callable($callback)) {
-            throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given');
-        }
-        array_unshift($this->processors, $callback);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function popProcessor()
-    {
-        if (!$this->processors) {
-            throw new \LogicException('You tried to pop from an empty processor stack.');
-        }
-
-        return array_shift($this->processors);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function setFormatter(FormatterInterface $formatter)
-    {
-        $this->formatter = $formatter;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getFormatter()
-    {
-        if (!$this->formatter) {
-            $this->formatter = $this->getDefaultFormatter();
-        }
-
-        return $this->formatter;
-    }
-
-    /**
-     * Sets minimum logging level at which this handler will be triggered.
-     *
-     * @param integer $level
-     */
-    public function setLevel($level)
-    {
-        $this->level = $level;
-    }
-
-    /**
-     * Gets minimum logging level at which this handler will be triggered.
-     *
-     * @return integer
-     */
-    public function getLevel()
-    {
-        return $this->level;
-    }
-
-    /**
-     * Sets the bubbling behavior.
-     *
-     * @param Boolean $bubble True means that bubbling is not permitted.
-     *                        False means that this handler allows bubbling.
-     */
-    public function setBubble($bubble)
-    {
-        $this->bubble = $bubble;
-    }
-
-    /**
-     * Gets the bubbling behavior.
-     *
-     * @return Boolean True means that bubbling is not permitted.
-     *                 False means that this handler allows bubbling.
-     */
-    public function getBubble()
-    {
-        return $this->bubble;
-    }
-
-    public function __destruct()
-    {
-        try {
-            $this->close();
-        } catch (\Exception $e) {
-            // do nothing
-        }
-    }
-
-    /**
-     * Gets the default formatter.
-     *
-     * @return FormatterInterface
-     */
-    protected function getDefaultFormatter()
-    {
-        return new LineFormatter();
-    }
-}

+ 0 - 66
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/AbstractProcessingHandler.php

@@ -1,66 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-/**
- * Base Handler class providing the Handler structure
- *
- * Classes extending it should (in most cases) only implement write($record)
- *
- * @author Jordi Boggiano <[email protected]>
- * @author Christophe Coevoet <[email protected]>
- */
-abstract class AbstractProcessingHandler extends AbstractHandler
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function handle(array $record)
-    {
-        if ($record['level'] < $this->level) {
-            return false;
-        }
-
-        $record = $this->processRecord($record);
-
-        $record['formatted'] = $this->getFormatter()->format($record);
-
-        $this->write($record);
-
-        return false === $this->bubble;
-    }
-
-    /**
-     * Writes the record down to the log of the implementing handler
-     *
-     * @param  array $record
-     * @return void
-     */
-    abstract protected function write(array $record);
-
-    /**
-     * Processes a record.
-     *
-     * @param  array $record
-     * @return array
-     */
-    protected function processRecord(array $record)
-    {
-        if ($this->processors) {
-            foreach ($this->processors as $processor) {
-                $record = call_user_func($processor, $record);
-            }
-        }
-
-        return $record;
-    }
-}

+ 0 - 69
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/AmqpHandler.php

@@ -1,69 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-use Monolog\Formatter\JsonFormatter;
-
-class AmqpHandler extends AbstractProcessingHandler
-{
-    /**
-     * @var \AMQPExchange $exchange
-     */
-    protected $exchange;
-
-    /**
-     * @param \AMQPExchange $exchange     AMQP exchange, ready for use
-     * @param string        $exchangeName
-     * @param int           $level
-     * @param bool          $bubble       Whether the messages that are handled can bubble up the stack or not
-     */
-    public function __construct(\AMQPExchange $exchange, $exchangeName = 'log', $level = Logger::DEBUG, $bubble = true)
-    {
-        $this->exchange = $exchange;
-        $this->exchange->setName($exchangeName);
-
-        parent::__construct($level, $bubble);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected function write(array $record)
-    {
-        $data = $record["formatted"];
-
-        $routingKey = sprintf(
-            '%s.%s',
-            substr($record['level_name'], 0, 4),
-            $record['channel']
-        );
-
-        $this->exchange->publish(
-            $data,
-            strtolower($routingKey),
-            0,
-            array(
-                'delivery_mode' => 2,
-                'Content-type' => 'application/json'
-            )
-        );
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected function getDefaultFormatter()
-    {
-        return new JsonFormatter();
-    }
-}

+ 0 - 92
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/BufferHandler.php

@@ -1,92 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-
-/**
- * Buffers all records until closing the handler and then pass them as batch.
- *
- * This is useful for a MailHandler to send only one mail per request instead of
- * sending one per log message.
- *
- * @author Christophe Coevoet <[email protected]>
- */
-class BufferHandler extends AbstractHandler
-{
-    protected $handler;
-    protected $bufferSize = 0;
-    protected $bufferLimit;
-    protected $flushOnOverflow;
-    protected $buffer = array();
-
-    /**
-     * @param HandlerInterface $handler         Handler.
-     * @param integer          $bufferSize      How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
-     * @param integer          $level           The minimum logging level at which this handler will be triggered
-     * @param Boolean          $bubble          Whether the messages that are handled can bubble up the stack or not
-     * @param Boolean          $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded
-     */
-    public function __construct(HandlerInterface $handler, $bufferSize = 0, $level = Logger::DEBUG, $bubble = true, $flushOnOverflow = false)
-    {
-        parent::__construct($level, $bubble);
-        $this->handler = $handler;
-        $this->bufferLimit = (int) $bufferSize;
-        $this->flushOnOverflow = $flushOnOverflow;
-
-        // __destructor() doesn't get called on Fatal errors
-        register_shutdown_function(array($this, 'close'));
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function handle(array $record)
-    {
-        if ($record['level'] < $this->level) {
-            return false;
-        }
-
-        if ($this->bufferLimit > 0 && $this->bufferSize === $this->bufferLimit) {
-            if ($this->flushOnOverflow) {
-                $this->flush();
-            } else {
-                array_shift($this->buffer);
-                $this->bufferSize--;
-            }
-        }
-
-        $this->buffer[] = $record;
-        $this->bufferSize++;
-
-        return false === $this->bubble;
-    }
-
-    public function flush()
-    {
-        if ($this->bufferSize === 0) {
-            return;
-        }
-
-        $this->handler->handleBatch($this->buffer);
-        $this->bufferSize = 0;
-        $this->buffer = array();
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function close()
-    {
-        $this->flush();
-    }
-}

+ 0 - 126
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/ChromePHPHandler.php

@@ -1,126 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Formatter\ChromePHPFormatter;
-
-/**
- * Handler sending logs to the ChromePHP extension (http://www.chromephp.com/)
- *
- * @author Christophe Coevoet <[email protected]>
- */
-class ChromePHPHandler extends AbstractProcessingHandler
-{
-    /**
-     * Version of the extension
-     */
-    const VERSION = '3.0';
-
-    /**
-     * Header name
-     */
-    const HEADER_NAME = 'X-ChromePhp-Data';
-
-    protected static $initialized = false;
-
-    protected static $json = array(
-        'version' => self::VERSION,
-        'columns' => array('label', 'log', 'backtrace', 'type'),
-        'rows' => array(),
-    );
-
-    protected $sendHeaders = true;
-
-    /**
-     * {@inheritdoc}
-     */
-    public function handleBatch(array $records)
-    {
-        $messages = array();
-
-        foreach ($records as $record) {
-            if ($record['level'] < $this->level) {
-                continue;
-            }
-            $messages[] = $this->processRecord($record);
-        }
-
-        if (!empty($messages)) {
-            $messages = $this->getFormatter()->formatBatch($messages);
-            self::$json['rows'] = array_merge(self::$json['rows'], $messages);
-            $this->send();
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected function getDefaultFormatter()
-    {
-        return new ChromePHPFormatter();
-    }
-
-    /**
-     * Creates & sends header for a record
-     *
-     * @see sendHeader()
-     * @see send()
-     * @param array $record
-     */
-    protected function write(array $record)
-    {
-        self::$json['rows'][] = $record['formatted'];
-
-        $this->send();
-    }
-
-    /**
-     * Sends the log header
-     *
-     * @see sendHeader()
-     */
-    protected function send()
-    {
-        if (!self::$initialized) {
-            $this->sendHeaders = $this->headersAccepted();
-            self::$json['request_uri'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
-
-            self::$initialized = true;
-        }
-
-        $this->sendHeader(self::HEADER_NAME, base64_encode(utf8_encode(json_encode(self::$json))));
-    }
-
-    /**
-     * Send header string to the client
-     *
-     * @param string $header
-     * @param string $content
-     */
-    protected function sendHeader($header, $content)
-    {
-        if (!headers_sent() && $this->sendHeaders) {
-            header(sprintf('%s: %s', $header, $content));
-        }
-    }
-
-    /**
-     * Verifies if the headers are accepted by the current user agent
-     *
-     * @return Boolean
-     */
-    protected function headersAccepted()
-    {
-        return !isset($_SERVER['HTTP_USER_AGENT'])
-               || preg_match('{\bChrome/\d+[\.\d+]*\b}', $_SERVER['HTTP_USER_AGENT']);
-    }
-}

+ 0 - 72
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/CouchDBHandler.php

@@ -1,72 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Formatter\JsonFormatter;
-use Monolog\Logger;
-
-/**
- * CouchDB handler
- *
- * @author Markus Bachmann <[email protected]>
- */
-class CouchDBHandler extends AbstractProcessingHandler
-{
-    private $options;
-
-    public function __construct(array $options = array(), $level = Logger::DEBUG, $bubble = true)
-    {
-        $this->options = array_merge(array(
-            'host'     => 'localhost',
-            'port'     => 5984,
-            'dbname'   => 'logger',
-            'username' => null,
-            'password' => null,
-        ), $options);
-
-        parent::__construct($level, $bubble);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected function write(array $record)
-    {
-        $basicAuth = null;
-        if ($this->options['username']) {
-            $basicAuth = sprintf('%s:%s@', $this->options['username'], $this->options['password']);
-        }
-
-        $url = 'http://'.$basicAuth.$this->options['host'].':'.$this->options['port'].'/'.$this->options['dbname'];
-        $context = stream_context_create(array(
-            'http' => array(
-                'method'        => 'POST',
-                'content'       => $record['formatted'],
-                'ignore_errors' => true,
-                'max_redirects' => 0,
-                'header'        => 'Content-type: application/json',
-            )
-        ));
-
-        if (false === @file_get_contents($url, null, $context)) {
-            throw new \RuntimeException(sprintf('Could not connect to %s', $url));
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected function getDefaultFormatter()
-    {
-        return new JsonFormatter();
-    }
-}

+ 0 - 145
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/CubeHandler.php

@@ -1,145 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-
-/**
- * Logs to Cube.
- *
- * @link http://square.github.com/cube/
- * @author Wan Chen <[email protected]>
- */
-class CubeHandler extends AbstractProcessingHandler
-{
-    private $udpConnection = null;
-    private $httpConnection = null;
-    private $scheme = null;
-    private $host = null;
-    private $port = null;
-    private $acceptedSchemes = array('http', 'udp');
-
-    /**
-     * Create a Cube handler
-     *
-     * @throws UnexpectedValueException when given url is not a valid url.
-     * A valid url must consists of three parts : protocol://host:port
-     * Only valid protocol used by Cube are http and udp
-     */
-    public function __construct($url, $level = Logger::DEBUG, $bubble = true)
-    {
-        $urlInfos = parse_url($url);
-
-        if (!isset($urlInfos['scheme']) || !isset($urlInfos['host']) || !isset($urlInfos['port'])) {
-            throw new \UnexpectedValueException('URL "'.$url.'" is not valid');
-        }
-
-        if (!in_array($urlInfos['scheme'], $this->acceptedSchemes)) {
-            throw new \UnexpectedValueException(
-                'Invalid protocol (' . $urlInfos['scheme']  . ').'
-                . ' Valid options are ' . implode(', ', $this->acceptedSchemes));
-        }
-
-        $this->scheme = $urlInfos['scheme'];
-        $this->host = $urlInfos['host'];
-        $this->port = $urlInfos['port'];
-
-        parent::__construct($level, $bubble);
-    }
-
-    /**
-     * Establish a connection to an UDP socket
-     *
-     * @throws LogicException when unable to connect to the socket
-     */
-    protected function connectUdp()
-    {
-        if (!extension_loaded('sockets')) {
-            throw new \LogicException('The sockets extension is needed to use udp URLs with the CubeHandler');
-        }
-
-        $this->udpConnection = socket_create(AF_INET, SOCK_DGRAM, 0);
-        if (!$this->udpConnection) {
-            throw new \LogicException('Unable to create a socket');
-        }
-
-        if (!socket_connect($this->udpConnection, $this->host, $this->port)) {
-            throw new \LogicException('Unable to connect to the socket at ' . $this->host . ':' . $this->port);
-        }
-    }
-
-    /**
-     * Establish a connection to a http server
-     */
-    protected function connectHttp()
-    {
-        if (!extension_loaded('curl')) {
-            throw new \LogicException('The curl extension is needed to use http URLs with the CubeHandler');
-        }
-
-        $this->httpConnection = curl_init('http://'.$this->host.':'.$this->port.'/1.0/event/put');
-
-        if (!$this->httpConnection) {
-            throw new \LogicException('Unable to connect to ' . $this->host . ':' . $this->port);
-        }
-
-        curl_setopt($this->httpConnection, CURLOPT_CUSTOMREQUEST, "POST");
-        curl_setopt($this->httpConnection, CURLOPT_RETURNTRANSFER, true);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    protected function write(array $record)
-    {
-        $date = $record['datetime'];
-
-        $data = array('time' => $date->format('Y-m-d\TH:i:s.u'));
-        unset($record['datetime']);
-
-        if (isset($record['context']['type'])) {
-            $data['type'] = $record['context']['type'];
-            unset($record['context']['type']);
-        } else {
-            $data['type'] = $record['channel'];
-        }
-
-        $data['data'] = $record['context'];
-        $data['data']['level'] = $record['level'];
-
-        $this->{'write'.$this->scheme}(json_encode($data));
-    }
-
-    private function writeUdp($data)
-    {
-        if (!$this->udpConnection) {
-            $this->connectUdp();
-        }
-
-        socket_send($this->udpConnection, $data, strlen($data), 0);
-    }
-
-    private function writeHttp($data)
-    {
-        if (!$this->httpConnection) {
-            $this->connectHttp();
-        }
-
-        curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, '['.$data.']');
-        curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, array(
-                'Content-Type: application/json',
-                'Content-Length: ' . strlen('['.$data.']'))
-        );
-
-        return curl_exec($this->httpConnection);
-    }
-}

+ 0 - 45
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/DoctrineCouchDBHandler.php

@@ -1,45 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-use Monolog\Formatter\NormalizerFormatter;
-use Doctrine\CouchDB\CouchDBClient;
-
-/**
- * CouchDB handler for Doctrine CouchDB ODM
- *
- * @author Markus Bachmann <[email protected]>
- */
-class DoctrineCouchDBHandler extends AbstractProcessingHandler
-{
-    private $client;
-
-    public function __construct(CouchDBClient $client, $level = Logger::DEBUG, $bubble = true)
-    {
-        $this->client = $client;
-        parent::__construct($level, $bubble);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected function write(array $record)
-    {
-        $this->client->postDocument($record['formatted']);
-    }
-
-    protected function getDefaultFormatter()
-    {
-        return new NormalizerFormatter;
-    }
-}

+ 0 - 28
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php

@@ -1,28 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler\FingersCrossed;
-
-/**
- * Interface for activation strategies for the FingersCrossedHandler.
- *
- * @author Johannes M. Schmitt <[email protected]>
- */
-interface ActivationStrategyInterface
-{
-    /**
-     * Returns whether the given record activates the handler.
-     *
-     * @param  array   $record
-     * @return Boolean
-     */
-    public function isHandlerActivated(array $record);
-}

+ 0 - 32
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php

@@ -1,32 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler\FingersCrossed;
-
-/**
- * Error level based activation strategy.
- *
- * @author Johannes M. Schmitt <[email protected]>
- */
-class ErrorLevelActivationStrategy implements ActivationStrategyInterface
-{
-    private $actionLevel;
-
-    public function __construct($actionLevel)
-    {
-        $this->actionLevel = $actionLevel;
-    }
-
-    public function isHandlerActivated(array $record)
-    {
-        return $record['level'] >= $this->actionLevel;
-    }
-}

+ 0 - 107
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/FingersCrossedHandler.php

@@ -1,107 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
-use Monolog\Handler\FingersCrossed\ActivationStrategyInterface;
-use Monolog\Logger;
-
-/**
- * Buffers all records until a certain level is reached
- *
- * The advantage of this approach is that you don't get any clutter in your log files.
- * Only requests which actually trigger an error (or whatever your actionLevel is) will be
- * in the logs, but they will contain all records, not only those above the level threshold.
- *
- * @author Jordi Boggiano <[email protected]>
- */
-class FingersCrossedHandler extends AbstractHandler
-{
-    protected $handler;
-    protected $activationStrategy;
-    protected $buffering = true;
-    protected $bufferSize;
-    protected $buffer = array();
-    protected $stopBuffering;
-
-    /**
-     * @param callable|HandlerInterface       $handler            Handler or factory callable($record, $fingersCrossedHandler).
-     * @param int|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action
-     * @param int                             $bufferSize         How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
-     * @param Boolean                         $bubble             Whether the messages that are handled can bubble up the stack or not
-     * @param Boolean                         $stopBuffering      Whether the handler should stop buffering after being triggered (default true)
-     */
-    public function __construct($handler, $activationStrategy = null, $bufferSize = 0, $bubble = true, $stopBuffering = true)
-    {
-        if (null === $activationStrategy) {
-            $activationStrategy = new ErrorLevelActivationStrategy(Logger::WARNING);
-        }
-        if (!$activationStrategy instanceof ActivationStrategyInterface) {
-            $activationStrategy = new ErrorLevelActivationStrategy($activationStrategy);
-        }
-
-        $this->handler = $handler;
-        $this->activationStrategy = $activationStrategy;
-        $this->bufferSize = $bufferSize;
-        $this->bubble = $bubble;
-        $this->stopBuffering = $stopBuffering;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function isHandling(array $record)
-    {
-        return true;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function handle(array $record)
-    {
-        if ($this->buffering) {
-            $this->buffer[] = $record;
-            if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) {
-                array_shift($this->buffer);
-            }
-            if ($this->activationStrategy->isHandlerActivated($record)) {
-                if ($this->stopBuffering) {
-                    $this->buffering = false;
-                }
-                if (!$this->handler instanceof HandlerInterface) {
-                    if (!is_callable($this->handler)) {
-                        throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object");
-                    }
-                    $this->handler = call_user_func($this->handler, $record, $this);
-                    if (!$this->handler instanceof HandlerInterface) {
-                        throw new \RuntimeException("The factory callable should return a HandlerInterface");
-                    }
-                }
-                $this->handler->handleBatch($this->buffer);
-                $this->buffer = array();
-            }
-        } else {
-            $this->handler->handle($record);
-        }
-
-        return false === $this->bubble;
-    }
-
-    /**
-     * Resets the state of the handler. Stops forwarding records to the wrapped handler.
-     */
-    public function reset()
-    {
-        $this->buffering = true;
-    }
-}

+ 0 - 160
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/FirePHPHandler.php

@@ -1,160 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Formatter\WildfireFormatter;
-
-/**
- * Simple FirePHP Handler (http://www.firephp.org/), which uses the Wildfire protocol.
- *
- * @author Eric Clemmons (@ericclemmons) <[email protected]>
- */
-class FirePHPHandler extends AbstractProcessingHandler
-{
-    /**
-     * WildFire JSON header message format
-     */
-    const PROTOCOL_URI = 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2';
-
-    /**
-     * FirePHP structure for parsing messages & their presentation
-     */
-    const STRUCTURE_URI = 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1';
-
-    /**
-     * Must reference a "known" plugin, otherwise headers won't display in FirePHP
-     */
-    const PLUGIN_URI = 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3';
-
-    /**
-     * Header prefix for Wildfire to recognize & parse headers
-     */
-    const HEADER_PREFIX = 'X-Wf';
-
-    /**
-     * Whether or not Wildfire vendor-specific headers have been generated & sent yet
-     */
-    protected static $initialized = false;
-
-    /**
-     * Shared static message index between potentially multiple handlers
-     * @var int
-     */
-    protected static $messageIndex = 1;
-
-    protected $sendHeaders = true;
-
-    /**
-     * Base header creation function used by init headers & record headers
-     *
-     * @param  array  $meta    Wildfire Plugin, Protocol & Structure Indexes
-     * @param  string $message Log message
-     * @return array  Complete header string ready for the client as key and message as value
-     */
-    protected function createHeader(array $meta, $message)
-    {
-        $header = sprintf('%s-%s', self::HEADER_PREFIX, join('-', $meta));
-
-        return array($header => $message);
-    }
-
-    /**
-     * Creates message header from record
-     *
-     * @see createHeader()
-     * @param  array  $record
-     * @return string
-     */
-    protected function createRecordHeader(array $record)
-    {
-        // Wildfire is extensible to support multiple protocols & plugins in a single request,
-        // but we're not taking advantage of that (yet), so we're using "1" for simplicity's sake.
-        return $this->createHeader(
-            array(1, 1, 1, self::$messageIndex++),
-            $record['formatted']
-        );
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected function getDefaultFormatter()
-    {
-        return new WildfireFormatter();
-    }
-
-    /**
-     * Wildfire initialization headers to enable message parsing
-     *
-     * @see createHeader()
-     * @see sendHeader()
-     * @return array
-     */
-    protected function getInitHeaders()
-    {
-        // Initial payload consists of required headers for Wildfire
-        return array_merge(
-            $this->createHeader(array('Protocol', 1), self::PROTOCOL_URI),
-            $this->createHeader(array(1, 'Structure', 1), self::STRUCTURE_URI),
-            $this->createHeader(array(1, 'Plugin', 1), self::PLUGIN_URI)
-        );
-    }
-
-    /**
-     * Send header string to the client
-     *
-     * @param string $header
-     * @param string $content
-     */
-    protected function sendHeader($header, $content)
-    {
-        if (!headers_sent() && $this->sendHeaders) {
-            header(sprintf('%s: %s', $header, $content));
-        }
-    }
-
-    /**
-     * Creates & sends header for a record, ensuring init headers have been sent prior
-     *
-     * @see sendHeader()
-     * @see sendInitHeaders()
-     * @param array $record
-     */
-    protected function write(array $record)
-    {
-        // WildFire-specific headers must be sent prior to any messages
-        if (!self::$initialized) {
-            $this->sendHeaders = $this->headersAccepted();
-
-            foreach ($this->getInitHeaders() as $header => $content) {
-                $this->sendHeader($header, $content);
-            }
-
-            self::$initialized = true;
-        }
-
-        $header = $this->createRecordHeader($record);
-        $this->sendHeader(key($header), current($header));
-    }
-
-    /**
-     * Verifies if the headers are accepted by the current user agent
-     *
-     * @return Boolean
-     */
-    protected function headersAccepted()
-    {
-        return !isset($_SERVER['HTTP_USER_AGENT'])
-               || preg_match('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT'])
-               || isset($_SERVER['HTTP_X_FIREPHP_VERSION']);
-    }
-}

+ 0 - 66
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/GelfHandler.php

@@ -1,66 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Gelf\IMessagePublisher;
-use Monolog\Logger;
-use Monolog\Handler\AbstractProcessingHandler;
-use Monolog\Formatter\GelfMessageFormatter;
-
-/**
- * Handler to send messages to a Graylog2 (http://www.graylog2.org) server
- *
- * @author Matt Lehner <[email protected]>
- */
-class GelfHandler extends AbstractProcessingHandler
-{
-    /**
-     * @var Gelf\IMessagePublisher the publisher object that sends the message to the server
-     */
-    protected $publisher;
-
-    /**
-     * @param Gelf\IMessagePublisher $publisher a publisher object
-     * @param integer                $level     The minimum logging level at which this handler will be triggered
-     * @param Boolean                $bubble    Whether the messages that are handled can bubble up the stack or not
-     */
-    public function __construct(IMessagePublisher $publisher, $level = Logger::DEBUG, $bubble = true)
-    {
-        parent::__construct($level, $bubble);
-
-        $this->publisher = $publisher;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function close()
-    {
-        $this->publisher = null;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    protected function write(array $record)
-    {
-        $this->publisher->publish($record['formatted']);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected function getDefaultFormatter()
-    {
-        return new GelfMessageFormatter();
-    }
-}

+ 0 - 74
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/GroupHandler.php

@@ -1,74 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-/**
- * Forwards records to multiple handlers
- *
- * @author Lenar Lõhmus <[email protected]>
- */
-class GroupHandler extends AbstractHandler
-{
-    protected $handlers;
-
-    /**
-     * @param array   $handlers Array of Handlers.
-     * @param Boolean $bubble   Whether the messages that are handled can bubble up the stack or not
-     */
-    public function __construct(array $handlers, $bubble = true)
-    {
-        foreach ($handlers as $handler) {
-            if (!$handler instanceof HandlerInterface) {
-                throw new \InvalidArgumentException('The first argument of the GroupHandler must be an array of HandlerInterface instances.');
-            }
-        }
-
-        $this->handlers = $handlers;
-        $this->bubble = $bubble;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function isHandling(array $record)
-    {
-        foreach ($this->handlers as $handler) {
-            if ($handler->isHandling($record)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function handle(array $record)
-    {
-        foreach ($this->handlers as $handler) {
-            $handler->handle($record);
-        }
-
-        return false === $this->bubble;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function handleBatch(array $records)
-    {
-        foreach ($this->handlers as $handler) {
-            $handler->handleBatch($records);
-        }
-    }
-}

+ 0 - 88
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/HandlerInterface.php

@@ -1,88 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Formatter\FormatterInterface;
-
-/**
- * Interface that all Monolog Handlers must implement
- *
- * @author Jordi Boggiano <[email protected]>
- */
-interface HandlerInterface
-{
-    /**
-     * Checks whether the given record will be handled by this handler.
-     *
-     * This is mostly done for performance reasons, to avoid calling processors for nothing.
-     *
-     * Handlers should still check the record levels within handle(), returning false in isHandling()
-     * is no guarantee that handle() will not be called, and isHandling() might not be called
-     * for a given record.
-     *
-     * @param array $record
-     *
-     * @return Boolean
-     */
-    public function isHandling(array $record);
-
-    /**
-     * Handles a record.
-     *
-     * All records may be passed to this method, and the handler should discard
-     * those that it does not want to handle.
-     *
-     * The return value of this function controls the bubbling process of the handler stack.
-     * Unless the bubbling is interrupted (by returning true), the Logger class will keep on
-     * calling further handlers in the stack with a given log record.
-     *
-     * @param  array   $record The record to handle
-     * @return Boolean True means that this handler handled the record, and that bubbling is not permitted.
-     *                 False means the record was either not processed or that this handler allows bubbling.
-     */
-    public function handle(array $record);
-
-    /**
-     * Handles a set of records at once.
-     *
-     * @param array $records The records to handle (an array of record arrays)
-     */
-    public function handleBatch(array $records);
-
-    /**
-     * Adds a processor in the stack.
-     *
-     * @param callable $callback
-     */
-    public function pushProcessor($callback);
-
-    /**
-     * Removes the processor on top of the stack and returns it.
-     *
-     * @return callable
-     */
-    public function popProcessor();
-
-    /**
-     * Sets the formatter.
-     *
-     * @param FormatterInterface $formatter
-     */
-    public function setFormatter(FormatterInterface $formatter);
-
-    /**
-     * Gets the formatter.
-     *
-     * @return FormatterInterface
-     */
-    public function getFormatter();
-}

+ 0 - 55
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/MailHandler.php

@@ -1,55 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-/**
- * Base class for all mail handlers
- *
- * @author Gyula Sallai
- */
-abstract class MailHandler extends AbstractProcessingHandler
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function handleBatch(array $records)
-    {
-        $messages = array();
-
-        foreach ($records as $record) {
-            if ($record['level'] < $this->level) {
-                continue;
-            }
-            $messages[] = $this->processRecord($record);
-        }
-
-        if (!empty($messages)) {
-            $this->send((string) $this->getFormatter()->formatBatch($messages), $messages);
-        }
-    }
-
-    /**
-     * Send a mail with the given content
-     *
-     * @param string $content
-     * @param array  $records the array of log records that formed this content
-     */
-    abstract protected function send($content, array $records);
-
-    /**
-     * {@inheritdoc}
-     */
-    protected function write(array $record)
-    {
-        $this->send((string) $record['formatted'], array($record));
-    }
-}

+ 0 - 55
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/MongoDBHandler.php

@@ -1,55 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Thomas Tourlourat <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-use Monolog\Formatter\NormalizerFormatter;
-
-/**
- * Logs to a MongoDB database.
- *
- * usage example:
- *
- *   $log = new Logger('application');
- *   $mongodb = new MongoDBHandler(new \Mongo("mongodb://localhost:27017"), "logs", "prod");
- *   $log->pushHandler($mongodb);
- *
- * @author Thomas Tourlourat <[email protected]>
- */
-class MongoDBHandler extends AbstractProcessingHandler
-{
-    private $mongoCollection;
-
-    public function __construct($mongo, $database, $collection, $level = Logger::DEBUG, $bubble = true)
-    {
-        if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) {
-            throw new \InvalidArgumentException('MongoClient or Mongo instance required');
-        }
-
-        $this->mongoCollection = $mongo->selectCollection($database, $collection);
-
-        parent::__construct($level, $bubble);
-    }
-
-    protected function write(array $record)
-    {
-        $this->mongoCollection->save($record["formatted"]);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected function getDefaultFormatter()
-    {
-        return new NormalizerFormatter();
-    }
-}

+ 0 - 65
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/NativeMailerHandler.php

@@ -1,65 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-
-/**
- * NativeMailerHandler uses the mail() function to send the emails
- *
- * @author Christophe Coevoet <[email protected]>
- */
-class NativeMailerHandler extends MailHandler
-{
-    protected $to;
-    protected $subject;
-    protected $headers = array(
-        'Content-type: text/plain; charset=utf-8'
-    );
-
-    /**
-     * @param string|array $to      The receiver of the mail
-     * @param string       $subject The subject of the mail
-     * @param string       $from    The sender of the mail
-     * @param integer      $level   The minimum logging level at which this handler will be triggered
-     * @param boolean      $bubble  Whether the messages that are handled can bubble up the stack or not
-     */
-    public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true)
-    {
-        parent::__construct($level, $bubble);
-        $this->to = is_array($to) ? $to : array($to);
-        $this->subject = $subject;
-        $this->headers[] = sprintf('From: %s', $from);
-    }
-
-    /**
-     * @param string|array $headers Custom added headers
-     */
-    public function addHeader($headers)
-    {
-        if (is_array($headers)) {
-            $this->headers = array_merge($this->headers, $headers);
-        } else {
-            $this->headers[] = $headers;
-        }
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    protected function send($content, array $records)
-    {
-        foreach ($this->to as $to) {
-            mail($to, $this->subject, wordwrap($content, 70), implode("\r\n", $this->headers) . "\r\n");
-        }
-    }
-}

+ 0 - 45
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/NullHandler.php

@@ -1,45 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-
-/**
- * Blackhole
- *
- * Any record it can handle will be thrown away. This can be used
- * to put on top of an existing stack to override it temporarily.
- *
- * @author Jordi Boggiano <[email protected]>
- */
-class NullHandler extends AbstractHandler
-{
-    /**
-     * @param integer $level The minimum logging level at which this handler will be triggered
-     */
-    public function __construct($level = Logger::DEBUG)
-    {
-        parent::__construct($level, false);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function handle(array $record)
-    {
-        if ($record['level'] < $this->level) {
-            return false;
-        }
-
-        return true;
-    }
-}

+ 0 - 79
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/PushoverHandler.php

@@ -1,79 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-
-/**
- * Sends notifications through the pushover api to mobile phones
- *
- * @author Sebastian Göttschkes <[email protected]>
- * @see    https://www.pushover.net/api
- */
-class PushoverHandler extends SocketHandler
-{
-    private $token;
-    private $user;
-    private $title;
-
-    /**
-     * @param string  $token  Pushover api token
-     * @param string  $user   Pushover user id the message will be sent to
-     * @param string  $title  Title sent to Pushover API
-     * @param integer $level  The minimum logging level at which this handler will be triggered
-     * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
-     */
-    public function __construct($token, $user, $title = null, $level = Logger::CRITICAL, $bubble = true)
-    {
-        parent::__construct('api.pushover.net:80', $level, $bubble);
-
-        $this->token = $token;
-        $this->user = $user;
-        $this->title = $title ?: gethostname();
-    }
-
-    protected function generateDataStream($record)
-    {
-        $content = $this->buildContent($record);
-
-        return $this->buildHeader($content) . $content;
-    }
-
-    private function buildContent($record)
-    {
-        // Pushover has a limit of 512 characters on title and message combined.
-        $maxMessageLength = 512 - strlen($this->title);
-        $message = substr($record['message'], 0, $maxMessageLength);
-        $timestamp = $record['datetime']->getTimestamp();
-
-        $dataArray = array(
-            'token' => $this->token,
-            'user' => $this->user,
-            'message' => $message,
-            'title' => $this->title,
-            'timestamp' => $timestamp
-        );
-
-        return http_build_query($dataArray);
-    }
-
-    private function buildHeader($content)
-    {
-        $header = "POST /1/messages.json HTTP/1.1\r\n";
-        $header .= "Host: api.pushover.net\r\n";
-        $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
-        $header .= "Content-Length: " . strlen($content) . "\r\n";
-        $header .= "\r\n";
-
-        return $header;
-    }
-}

+ 0 - 72
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/RavenHandler.php

@@ -1,72 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-use Monolog\Handler\AbstractProcessingHandler;
-use Raven_Client;
-
-/**
- * Handler to send messages to a Sentry (https://github.com/dcramer/sentry) server
- * using raven-php (https://github.com/getsentry/raven-php)
- *
- * @author Marc Abramowitz <[email protected]>
- */
-class RavenHandler extends AbstractProcessingHandler
-{
-    /**
-     * Translates Monolog log levels to Raven log levels.
-     */
-    private $logLevels = array(
-        Logger::DEBUG     => Raven_Client::DEBUG,
-        Logger::INFO      => Raven_Client::INFO,
-        Logger::NOTICE    => Raven_Client::INFO,
-        Logger::WARNING   => Raven_Client::WARNING,
-        Logger::ERROR     => Raven_Client::ERROR,
-        Logger::CRITICAL  => Raven_Client::FATAL,
-        Logger::ALERT     => Raven_Client::FATAL,
-        Logger::EMERGENCY => Raven_Client::FATAL,
-    );
-
-    /**
-     * @var Raven_Client the client object that sends the message to the server
-     */
-    protected $ravenClient;
-
-    /**
-     * @param Raven_Client $ravenClient
-     * @param integer $level The minimum logging level at which this handler will be triggered
-     * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
-     */
-    public function __construct(Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true)
-    {
-        parent::__construct($level, $bubble);
-
-        $this->ravenClient = $ravenClient;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    protected function write(array $record)
-    {
-        $this->ravenClient->captureMessage(
-            $record['formatted'],
-            array(),                              // $params - not used
-            $this->logLevels[$record['level']],   // $level
-            false                                 // $stack
-        );
-        if ($record['level'] >= Logger::ERROR && isset($record['context']['exception'])) {
-            $this->ravenClient->captureException($record['context']['exception']);
-        }
-    }
-}

+ 0 - 109
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/RotatingFileHandler.php

@@ -1,109 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-
-/**
- * Stores logs to files that are rotated every day and a limited number of files are kept.
- *
- * This rotation is only intended to be used as a workaround. Using logrotate to
- * handle the rotation is strongly encouraged when you can use it.
- *
- * @author Christophe Coevoet <[email protected]>
- */
-class RotatingFileHandler extends StreamHandler
-{
-    protected $filename;
-    protected $maxFiles;
-    protected $mustRotate;
-
-    /**
-     * @param string  $filename
-     * @param integer $maxFiles The maximal amount of files to keep (0 means unlimited)
-     * @param integer $level    The minimum logging level at which this handler will be triggered
-     * @param Boolean $bubble   Whether the messages that are handled can bubble up the stack or not
-     */
-    public function __construct($filename, $maxFiles = 0, $level = Logger::DEBUG, $bubble = true)
-    {
-        $this->filename = $filename;
-        $this->maxFiles = (int) $maxFiles;
-
-        $fileInfo = pathinfo($this->filename);
-        $timedFilename = $fileInfo['dirname'].'/'.$fileInfo['filename'].'-'.date('Y-m-d');
-        if (!empty($fileInfo['extension'])) {
-            $timedFilename .= '.'.$fileInfo['extension'];
-        }
-
-        // disable rotation upfront if files are unlimited
-        if (0 === $this->maxFiles) {
-            $this->mustRotate = false;
-        }
-
-        parent::__construct($timedFilename, $level, $bubble);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function close()
-    {
-        parent::close();
-
-        if (true === $this->mustRotate) {
-            $this->rotate();
-        }
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    protected function write(array $record)
-    {
-        // on the first record written, if the log is new, we should rotate (once per day)
-        if (null === $this->mustRotate) {
-            $this->mustRotate = !file_exists($this->url);
-        }
-
-        parent::write($record);
-    }
-
-    /**
-     * Rotates the files.
-     */
-    protected function rotate()
-    {
-        $fileInfo = pathinfo($this->filename);
-        $glob = $fileInfo['dirname'].'/'.$fileInfo['filename'].'-*';
-        if (!empty($fileInfo['extension'])) {
-            $glob .= '.'.$fileInfo['extension'];
-        }
-        $iterator = new \GlobIterator($glob);
-        $count = $iterator->count();
-        if ($this->maxFiles >= $count) {
-            // no files to remove
-            return;
-        }
-
-        // Sorting the files by name to remove the older ones
-        $array = iterator_to_array($iterator);
-        usort($array, function($a, $b) {
-            return strcmp($b->getFilename(), $a->getFilename());
-        });
-
-        foreach (array_slice($array, $this->maxFiles) as $file) {
-            if ($file->isWritable()) {
-                unlink($file->getRealPath());
-            }
-        }
-    }
-}

+ 0 - 285
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/SocketHandler.php

@@ -1,285 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-
-/**
- * Stores to any socket - uses fsockopen() or pfsockopen().
- *
- * @author Pablo de Leon Belloc <[email protected]>
- * @see    http://php.net/manual/en/function.fsockopen.php
- */
-class SocketHandler extends AbstractProcessingHandler
-{
-    private $connectionString;
-    private $connectionTimeout;
-    private $resource;
-    private $timeout = 0;
-    private $persistent = false;
-    private $errno;
-    private $errstr;
-
-    /**
-     * @param string  $connectionString Socket connection string
-     * @param integer $level            The minimum logging level at which this handler will be triggered
-     * @param Boolean $bubble           Whether the messages that are handled can bubble up the stack or not
-     */
-    public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true)
-    {
-        parent::__construct($level, $bubble);
-        $this->connectionString = $connectionString;
-        $this->connectionTimeout = (float) ini_get('default_socket_timeout');
-    }
-
-    /**
-     * Connect (if necessary) and write to the socket
-     *
-     * @param array $record
-     *
-     * @throws \UnexpectedValueException
-     * @throws \RuntimeException
-     */
-    public function write(array $record)
-    {
-        $this->connectIfNotConnected();
-        $data = $this->generateDataStream($record);
-        $this->writeToSocket($data);
-    }
-
-    /**
-     * We will not close a PersistentSocket instance so it can be reused in other requests.
-     */
-    public function close()
-    {
-        if (!$this->isPersistent()) {
-            $this->closeSocket();
-        }
-    }
-
-    /**
-     * Close socket, if open
-     */
-    public function closeSocket()
-    {
-        if (is_resource($this->resource)) {
-            fclose($this->resource);
-            $this->resource = null;
-        }
-    }
-
-    /**
-     * Set socket connection to nbe persistent. It only has effect before the connection is initiated.
-     *
-     * @param type $boolean
-     */
-    public function setPersistent($boolean)
-    {
-        $this->persistent = (boolean) $boolean;
-    }
-
-    /**
-     * Set connection timeout.  Only has effect before we connect.
-     *
-     * @param float $seconds
-     *
-     * @see http://php.net/manual/en/function.fsockopen.php
-     */
-    public function setConnectionTimeout($seconds)
-    {
-        $this->validateTimeout($seconds);
-        $this->connectionTimeout = (float) $seconds;
-    }
-
-    /**
-     * Set write timeout. Only has effect before we connect.
-     *
-     * @param float $seconds
-     *
-     * @see http://php.net/manual/en/function.stream-set-timeout.php
-     */
-    public function setTimeout($seconds)
-    {
-        $this->validateTimeout($seconds);
-        $this->timeout = (float) $seconds;
-    }
-
-    /**
-     * Get current connection string
-     *
-     * @return string
-     */
-    public function getConnectionString()
-    {
-        return $this->connectionString;
-    }
-
-    /**
-     * Get persistent setting
-     *
-     * @return boolean
-     */
-    public function isPersistent()
-    {
-        return $this->persistent;
-    }
-
-    /**
-     * Get current connection timeout setting
-     *
-     * @return float
-     */
-    public function getConnectionTimeout()
-    {
-        return $this->connectionTimeout;
-    }
-
-    /**
-     * Get current in-transfer timeout
-     *
-     * @return float
-     */
-    public function getTimeout()
-    {
-        return $this->timeout;
-    }
-
-    /**
-     * Check to see if the socket is currently available.
-     *
-     * UDP might appear to be connected but might fail when writing.  See http://php.net/fsockopen for details.
-     *
-     * @return boolean
-     */
-    public function isConnected()
-    {
-        return is_resource($this->resource)
-            && !feof($this->resource);  // on TCP - other party can close connection.
-    }
-
-    /**
-     * Wrapper to allow mocking
-     */
-    protected function pfsockopen()
-    {
-        return @pfsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout);
-    }
-
-    /**
-     * Wrapper to allow mocking
-     */
-    protected function fsockopen()
-    {
-        return @fsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout);
-    }
-
-    /**
-     * Wrapper to allow mocking
-     *
-     * @see http://php.net/manual/en/function.stream-set-timeout.php
-     */
-    protected function streamSetTimeout()
-    {
-        $seconds = floor($this->timeout);
-        $microseconds = round(($this->timeout - $seconds)*1e6);
-
-        return stream_set_timeout($this->resource, $seconds, $microseconds);
-    }
-
-    /**
-     * Wrapper to allow mocking
-     */
-    protected function fwrite($data)
-    {
-        return @fwrite($this->resource, $data);
-    }
-
-    /**
-     * Wrapper to allow mocking
-     */
-    protected function streamGetMetadata()
-    {
-        return stream_get_meta_data($this->resource);
-    }
-
-    private function validateTimeout($value)
-    {
-        $ok = filter_var($value, FILTER_VALIDATE_FLOAT);
-        if ($ok === false || $value < 0) {
-            throw new \InvalidArgumentException("Timeout must be 0 or a positive float (got $value)");
-        }
-    }
-
-    private function connectIfNotConnected()
-    {
-        if ($this->isConnected()) {
-            return;
-        }
-        $this->connect();
-    }
-
-    protected function generateDataStream($record)
-    {
-        return (string) $record['formatted'];
-    }
-
-    private function connect()
-    {
-        $this->createSocketResource();
-        $this->setSocketTimeout();
-    }
-
-    private function createSocketResource()
-    {
-        if ($this->isPersistent()) {
-            $resource = $this->pfsockopen();
-        } else {
-            $resource = $this->fsockopen();
-        }
-        if (!$resource) {
-            throw new \UnexpectedValueException("Failed connecting to $this->connectionString ($this->errno: $this->errstr)");
-        }
-        $this->resource = $resource;
-    }
-
-    private function setSocketTimeout()
-    {
-        if (!$this->streamSetTimeout()) {
-            throw new \UnexpectedValueException("Failed setting timeout with stream_set_timeout()");
-        }
-    }
-
-    private function writeToSocket($data)
-    {
-        $length = strlen($data);
-        $sent = 0;
-        while ($this->isConnected() && $sent < $length) {
-            if (0 == $sent) {
-                $chunk = $this->fwrite($data);
-            } else {
-                $chunk = $this->fwrite(substr($data, $sent));
-            }
-            if ($chunk === false) {
-                throw new \RuntimeException("Could not write to socket");
-            }
-            $sent += $chunk;
-            $socketInfo = $this->streamGetMetadata();
-            if ($socketInfo['timed_out']) {
-                throw new \RuntimeException("Write timed-out");
-            }
-        }
-        if (!$this->isConnected() && $sent < $length) {
-            throw new \RuntimeException("End-of-file reached, probably we got disconnected (sent $sent of $length)");
-        }
-    }
-
-}

+ 0 - 76
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/StreamHandler.php

@@ -1,76 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-
-/**
- * Stores to any stream resource
- *
- * Can be used to store into php://stderr, remote and local files, etc.
- *
- * @author Jordi Boggiano <[email protected]>
- */
-class StreamHandler extends AbstractProcessingHandler
-{
-    protected $stream;
-    protected $url;
-
-    /**
-     * @param string  $stream
-     * @param integer $level  The minimum logging level at which this handler will be triggered
-     * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
-     */
-    public function __construct($stream, $level = Logger::DEBUG, $bubble = true)
-    {
-        parent::__construct($level, $bubble);
-        if (is_resource($stream)) {
-            $this->stream = $stream;
-        } else {
-            $this->url = $stream;
-        }
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function close()
-    {
-        if (is_resource($this->stream)) {
-            fclose($this->stream);
-        }
-        $this->stream = null;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    protected function write(array $record)
-    {
-        if (null === $this->stream) {
-            if (!$this->url) {
-                throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
-            }
-            $errorMessage = null;
-            set_error_handler(function ($code, $msg) use (&$errorMessage) {
-                $errorMessage = preg_replace('{^fopen\(.*?\): }', '', $msg);
-            });
-            $this->stream = fopen($this->url, 'a');
-            restore_error_handler();
-            if (!is_resource($this->stream)) {
-                $this->stream = null;
-                throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened: '.$errorMessage, $this->url));
-            }
-        }
-        fwrite($this->stream, (string) $record['formatted']);
-    }
-}

+ 0 - 55
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/SwiftMailerHandler.php

@@ -1,55 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-
-/**
- * SwiftMailerHandler uses Swift_Mailer to send the emails
- *
- * @author Gyula Sallai
- */
-class SwiftMailerHandler extends MailHandler
-{
-    protected $mailer;
-    protected $message;
-
-    /**
-     * @param \Swift_Mailer           $mailer  The mailer to use
-     * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced
-     * @param integer                 $level   The minimum logging level at which this handler will be triggered
-     * @param Boolean                 $bubble  Whether the messages that are handled can bubble up the stack or not
-     */
-    public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, $bubble = true)
-    {
-        parent::__construct($level, $bubble);
-        $this->mailer  = $mailer;
-        if (!$message instanceof \Swift_Message && is_callable($message)) {
-            $message = call_user_func($message);
-        }
-        if (!$message instanceof \Swift_Message) {
-            throw new \InvalidArgumentException('You must provide either a Swift_Message instance or a callable returning it');
-        }
-        $this->message = $message;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    protected function send($content, array $records)
-    {
-        $message = clone $this->message;
-        $message->setBody($content);
-
-        $this->mailer->send($message);
-    }
-}

+ 0 - 120
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/SyslogHandler.php

@@ -1,120 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-use Monolog\Formatter\LineFormatter;
-
-/**
- * Logs to syslog service.
- *
- * usage example:
- *
- *   $log = new Logger('application');
- *   $syslog = new SyslogHandler('myfacility', 'local6');
- *   $formatter = new LineFormatter("%channel%.%level_name%: %message% %extra%");
- *   $syslog->setFormatter($formatter);
- *   $log->pushHandler($syslog);
- *
- * @author Sven Paulus <[email protected]>
- */
-class SyslogHandler extends AbstractProcessingHandler
-{
-    /**
-     * Translates Monolog log levels to syslog log priorities.
-     */
-    private $logLevels = array(
-        Logger::DEBUG     => LOG_DEBUG,
-        Logger::INFO      => LOG_INFO,
-        Logger::NOTICE    => LOG_NOTICE,
-        Logger::WARNING   => LOG_WARNING,
-        Logger::ERROR     => LOG_ERR,
-        Logger::CRITICAL  => LOG_CRIT,
-        Logger::ALERT     => LOG_ALERT,
-        Logger::EMERGENCY => LOG_EMERG,
-    );
-
-    /**
-     * List of valid log facility names.
-     */
-    private $facilities = array(
-        'auth'     => LOG_AUTH,
-        'authpriv' => LOG_AUTHPRIV,
-        'cron'     => LOG_CRON,
-        'daemon'   => LOG_DAEMON,
-        'kern'     => LOG_KERN,
-        'lpr'      => LOG_LPR,
-        'mail'     => LOG_MAIL,
-        'news'     => LOG_NEWS,
-        'syslog'   => LOG_SYSLOG,
-        'user'     => LOG_USER,
-        'uucp'     => LOG_UUCP,
-    );
-
-    /**
-     * @param string  $ident
-     * @param mixed   $facility
-     * @param integer $level    The minimum logging level at which this handler will be triggered
-     * @param Boolean $bubble   Whether the messages that are handled can bubble up the stack or not
-     * @param int     $logopts  Option flags for the openlog() call, defaults to LOG_PID
-     */
-    public function __construct($ident, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $logopts = LOG_PID)
-    {
-        parent::__construct($level, $bubble);
-
-        if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
-            $this->facilities['local0'] = LOG_LOCAL0;
-            $this->facilities['local1'] = LOG_LOCAL1;
-            $this->facilities['local2'] = LOG_LOCAL2;
-            $this->facilities['local3'] = LOG_LOCAL3;
-            $this->facilities['local4'] = LOG_LOCAL4;
-            $this->facilities['local5'] = LOG_LOCAL5;
-            $this->facilities['local6'] = LOG_LOCAL6;
-            $this->facilities['local7'] = LOG_LOCAL7;
-        }
-
-        // convert textual description of facility to syslog constant
-        if (array_key_exists(strtolower($facility), $this->facilities)) {
-            $facility = $this->facilities[strtolower($facility)];
-        } elseif (!in_array($facility, array_values($this->facilities), true)) {
-            throw new \UnexpectedValueException('Unknown facility value "'.$facility.'" given');
-        }
-
-        if (!openlog($ident, $logopts, $facility)) {
-            throw new \LogicException('Can\'t open syslog for ident "'.$ident.'" and facility "'.$facility.'"');
-        }
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function close()
-    {
-        closelog();
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    protected function write(array $record)
-    {
-        syslog($this->logLevels[$record['level']], (string) $record['formatted']);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    protected function getDefaultFormatter()
-    {
-        return new LineFormatter('%channel%.%level_name%: %message% %context% %extra%');
-    }
-}

+ 0 - 140
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Handler/TestHandler.php

@@ -1,140 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Handler;
-
-use Monolog\Logger;
-
-/**
- * Used for testing purposes.
- *
- * It records all records and gives you access to them for verification.
- *
- * @author Jordi Boggiano <[email protected]>
- */
-class TestHandler extends AbstractProcessingHandler
-{
-    protected $records = array();
-    protected $recordsByLevel = array();
-
-    public function getRecords()
-    {
-        return $this->records;
-    }
-
-    public function hasEmergency($record)
-    {
-        return $this->hasRecord($record, Logger::EMERGENCY);
-    }
-
-    public function hasAlert($record)
-    {
-        return $this->hasRecord($record, Logger::ALERT);
-    }
-
-    public function hasCritical($record)
-    {
-        return $this->hasRecord($record, Logger::CRITICAL);
-    }
-
-    public function hasError($record)
-    {
-        return $this->hasRecord($record, Logger::ERROR);
-    }
-
-    public function hasWarning($record)
-    {
-        return $this->hasRecord($record, Logger::WARNING);
-    }
-
-    public function hasNotice($record)
-    {
-        return $this->hasRecord($record, Logger::NOTICE);
-    }
-
-    public function hasInfo($record)
-    {
-        return $this->hasRecord($record, Logger::INFO);
-    }
-
-    public function hasDebug($record)
-    {
-        return $this->hasRecord($record, Logger::DEBUG);
-    }
-
-    public function hasEmergencyRecords()
-    {
-        return isset($this->recordsByLevel[Logger::EMERGENCY]);
-    }
-
-    public function hasAlertRecords()
-    {
-        return isset($this->recordsByLevel[Logger::ALERT]);
-    }
-
-    public function hasCriticalRecords()
-    {
-        return isset($this->recordsByLevel[Logger::CRITICAL]);
-    }
-
-    public function hasErrorRecords()
-    {
-        return isset($this->recordsByLevel[Logger::ERROR]);
-    }
-
-    public function hasWarningRecords()
-    {
-        return isset($this->recordsByLevel[Logger::WARNING]);
-    }
-
-    public function hasNoticeRecords()
-    {
-        return isset($this->recordsByLevel[Logger::NOTICE]);
-    }
-
-    public function hasInfoRecords()
-    {
-        return isset($this->recordsByLevel[Logger::INFO]);
-    }
-
-    public function hasDebugRecords()
-    {
-        return isset($this->recordsByLevel[Logger::DEBUG]);
-    }
-
-    protected function hasRecord($record, $level)
-    {
-        if (!isset($this->recordsByLevel[$level])) {
-            return false;
-        }
-
-        if (is_array($record)) {
-            $record = $record['message'];
-        }
-
-        foreach ($this->recordsByLevel[$level] as $rec) {
-            if ($rec['message'] === $record) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    protected function write(array $record)
-    {
-        $this->recordsByLevel[$record['level']][] = $record;
-        $this->records[] = $record;
-    }
-}

+ 0 - 542
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Logger.php

@@ -1,542 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog;
-
-use Monolog\Handler\HandlerInterface;
-use Monolog\Handler\StreamHandler;
-use Psr\Log\LoggerInterface;
-use Psr\Log\InvalidArgumentException;
-
-/**
- * Monolog log channel
- *
- * It contains a stack of Handlers and a stack of Processors,
- * and uses them to store records that are added to it.
- *
- * @author Jordi Boggiano <[email protected]>
- */
-class Logger implements LoggerInterface
-{
-    /**
-     * Detailed debug information
-     */
-    const DEBUG = 100;
-
-    /**
-     * Interesting events
-     *
-     * Examples: User logs in, SQL logs.
-     */
-    const INFO = 200;
-
-    /**
-     * Uncommon events
-     */
-    const NOTICE = 250;
-
-    /**
-     * Exceptional occurrences that are not errors
-     *
-     * Examples: Use of deprecated APIs, poor use of an API,
-     * undesirable things that are not necessarily wrong.
-     */
-    const WARNING = 300;
-
-    /**
-     * Runtime errors
-     */
-    const ERROR = 400;
-
-    /**
-     * Critical conditions
-     *
-     * Example: Application component unavailable, unexpected exception.
-     */
-    const CRITICAL = 500;
-
-    /**
-     * Action must be taken immediately
-     *
-     * Example: Entire website down, database unavailable, etc.
-     * This should trigger the SMS alerts and wake you up.
-     */
-    const ALERT = 550;
-
-    /**
-     * Urgent alert.
-     */
-    const EMERGENCY = 600;
-
-    protected static $levels = array(
-        100 => 'DEBUG',
-        200 => 'INFO',
-        250 => 'NOTICE',
-        300 => 'WARNING',
-        400 => 'ERROR',
-        500 => 'CRITICAL',
-        550 => 'ALERT',
-        600 => 'EMERGENCY',
-    );
-
-    /**
-     * @var DateTimeZone
-     */
-    protected static $timezone;
-
-    protected $name;
-
-    /**
-     * The handler stack
-     *
-     * @var array of Monolog\Handler\HandlerInterface
-     */
-    protected $handlers = array();
-
-    protected $processors = array();
-
-    /**
-     * @param string $name The logging channel
-     */
-    public function __construct($name)
-    {
-        $this->name = $name;
-
-        if (!static::$timezone) {
-            static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC');
-        }
-    }
-
-    /**
-     * @return string
-     */
-    public function getName()
-    {
-        return $this->name;
-    }
-
-    /**
-     * Pushes a handler on to the stack.
-     *
-     * @param HandlerInterface $handler
-     */
-    public function pushHandler(HandlerInterface $handler)
-    {
-        array_unshift($this->handlers, $handler);
-    }
-
-    /**
-     * Pops a handler from the stack
-     *
-     * @return HandlerInterface
-     */
-    public function popHandler()
-    {
-        if (!$this->handlers) {
-            throw new \LogicException('You tried to pop from an empty handler stack.');
-        }
-
-        return array_shift($this->handlers);
-    }
-
-    /**
-     * Adds a processor on to the stack.
-     *
-     * @param callable $callback
-     */
-    public function pushProcessor($callback)
-    {
-        if (!is_callable($callback)) {
-            throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given');
-        }
-        array_unshift($this->processors, $callback);
-    }
-
-    /**
-     * Removes the processor on top of the stack and returns it.
-     *
-     * @return callable
-     */
-    public function popProcessor()
-    {
-        if (!$this->processors) {
-            throw new \LogicException('You tried to pop from an empty processor stack.');
-        }
-
-        return array_shift($this->processors);
-    }
-
-    /**
-     * Adds a log record.
-     *
-     * @param  integer $level   The logging level
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function addRecord($level, $message, array $context = array())
-    {
-        if (!$this->handlers) {
-            $this->pushHandler(new StreamHandler('php://stderr', static::DEBUG));
-        }
-        $record = array(
-            'message' => (string) $message,
-            'context' => $context,
-            'level' => $level,
-            'level_name' => static::getLevelName($level),
-            'channel' => $this->name,
-            'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone)->setTimezone(static::$timezone),
-            'extra' => array(),
-        );
-        // check if any handler will handle this message
-        $handlerKey = null;
-        foreach ($this->handlers as $key => $handler) {
-            if ($handler->isHandling($record)) {
-                $handlerKey = $key;
-                break;
-            }
-        }
-        // none found
-        if (null === $handlerKey) {
-            return false;
-        }
-
-        // found at least one, process message and dispatch it
-        foreach ($this->processors as $processor) {
-            $record = call_user_func($processor, $record);
-        }
-        while (isset($this->handlers[$handlerKey]) &&
-            false === $this->handlers[$handlerKey]->handle($record)) {
-            $handlerKey++;
-        }
-
-        return true;
-    }
-
-    /**
-     * Adds a log record at the DEBUG level.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function addDebug($message, array $context = array())
-    {
-        return $this->addRecord(static::DEBUG, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the INFO level.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function addInfo($message, array $context = array())
-    {
-        return $this->addRecord(static::INFO, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the NOTICE level.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function addNotice($message, array $context = array())
-    {
-        return $this->addRecord(static::NOTICE, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the WARNING level.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function addWarning($message, array $context = array())
-    {
-        return $this->addRecord(static::WARNING, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the ERROR level.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function addError($message, array $context = array())
-    {
-        return $this->addRecord(static::ERROR, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the CRITICAL level.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function addCritical($message, array $context = array())
-    {
-        return $this->addRecord(static::CRITICAL, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the ALERT level.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function addAlert($message, array $context = array())
-    {
-        return $this->addRecord(static::ALERT, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the EMERGENCY level.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function addEmergency($message, array $context = array())
-    {
-      return $this->addRecord(static::EMERGENCY, $message, $context);
-    }
-
-    /**
-     * Gets the name of the logging level.
-     *
-     * @param  integer $level
-     * @return string
-     */
-    public static function getLevelName($level)
-    {
-        if (!isset(static::$levels[$level])) {
-            throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels)));
-        }
-
-        return static::$levels[$level];
-    }
-
-    /**
-     * Checks whether the Logger has a handler that listens on the given level
-     *
-     * @param  integer $level
-     * @return Boolean
-     */
-    public function isHandling($level)
-    {
-        $record = array(
-            'level' => $level,
-        );
-
-        foreach ($this->handlers as $key => $handler) {
-            if ($handler->isHandling($record)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Adds a log record at an arbitrary level.
-     *
-     * This method allows for compatibility with common interfaces.
-     *
-     * @param  mixed   $level   The log level
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function log($level, $message, array $context = array())
-    {
-        if (is_string($level) && defined(__CLASS__.'::'.strtoupper($level))) {
-            $level = constant(__CLASS__.'::'.strtoupper($level));
-        }
-
-        return $this->addRecord($level, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the DEBUG level.
-     *
-     * This method allows for compatibility with common interfaces.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function debug($message, array $context = array())
-    {
-        return $this->addRecord(static::DEBUG, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the INFO level.
-     *
-     * This method allows for compatibility with common interfaces.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function info($message, array $context = array())
-    {
-        return $this->addRecord(static::INFO, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the INFO level.
-     *
-     * This method allows for compatibility with common interfaces.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function notice($message, array $context = array())
-    {
-        return $this->addRecord(static::NOTICE, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the WARNING level.
-     *
-     * This method allows for compatibility with common interfaces.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function warn($message, array $context = array())
-    {
-        return $this->addRecord(static::WARNING, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the WARNING level.
-     *
-     * This method allows for compatibility with common interfaces.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function warning($message, array $context = array())
-    {
-        return $this->addRecord(static::WARNING, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the ERROR level.
-     *
-     * This method allows for compatibility with common interfaces.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function err($message, array $context = array())
-    {
-        return $this->addRecord(static::ERROR, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the ERROR level.
-     *
-     * This method allows for compatibility with common interfaces.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function error($message, array $context = array())
-    {
-        return $this->addRecord(static::ERROR, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the CRITICAL level.
-     *
-     * This method allows for compatibility with common interfaces.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function crit($message, array $context = array())
-    {
-        return $this->addRecord(static::CRITICAL, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the CRITICAL level.
-     *
-     * This method allows for compatibility with common interfaces.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function critical($message, array $context = array())
-    {
-        return $this->addRecord(static::CRITICAL, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the ALERT level.
-     *
-     * This method allows for compatibility with common interfaces.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function alert($message, array $context = array())
-    {
-        return $this->addRecord(static::ALERT, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the EMERGENCY level.
-     *
-     * This method allows for compatibility with common interfaces.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function emerg($message, array $context = array())
-    {
-        return $this->addRecord(static::EMERGENCY, $message, $context);
-    }
-
-    /**
-     * Adds a log record at the EMERGENCY level.
-     *
-     * This method allows for compatibility with common interfaces.
-     *
-     * @param  string  $message The log message
-     * @param  array   $context The log context
-     * @return Boolean Whether the record has been processed
-     */
-    public function emergency($message, array $context = array())
-    {
-        return $this->addRecord(static::EMERGENCY, $message, $context);
-    }
-}

+ 0 - 58
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Processor/IntrospectionProcessor.php

@@ -1,58 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-/**
- * Injects line/file:class/function where the log message came from
- *
- * Warning: This only works if the handler processes the logs directly.
- * If you put the processor on a handler that is behind a FingersCrossedHandler
- * for example, the processor will only be called once the trigger level is reached,
- * and all the log records will have the same file/line/.. data from the call that
- * triggered the FingersCrossedHandler.
- *
- * @author Jordi Boggiano <[email protected]>
- */
-class IntrospectionProcessor
-{
-    /**
-     * @param  array $record
-     * @return array
-     */
-    public function __invoke(array $record)
-    {
-        $trace = debug_backtrace();
-
-        // skip first since it's always the current method
-        array_shift($trace);
-        // the call_user_func call is also skipped
-        array_shift($trace);
-
-        $i = 0;
-        while (isset($trace[$i]['class']) && false !== strpos($trace[$i]['class'], 'Monolog\\')) {
-            $i++;
-        }
-
-        // we should have the call source now
-        $record['extra'] = array_merge(
-            $record['extra'],
-            array(
-                'file'      => isset($trace[$i-1]['file']) ? $trace[$i-1]['file'] : null,
-                'line'      => isset($trace[$i-1]['line']) ? $trace[$i-1]['line'] : null,
-                'class'     => isset($trace[$i]['class']) ? $trace[$i]['class'] : null,
-                'function'  => isset($trace[$i]['function']) ? $trace[$i]['function'] : null,
-            )
-        );
-
-        return $record;
-    }
-}

+ 0 - 40
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Processor/MemoryPeakUsageProcessor.php

@@ -1,40 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-/**
- * Injects memory_get_peak_usage in all records
- *
- * @see Monolog\Processor\MemoryProcessor::__construct() for options
- * @author Rob Jensen
- */
-class MemoryPeakUsageProcessor extends MemoryProcessor
-{
-    /**
-     * @param  array $record
-     * @return array
-     */
-    public function __invoke(array $record)
-    {
-        $bytes = memory_get_peak_usage($this->realUsage);
-        $formatted = self::formatBytes($bytes);
-
-        $record['extra'] = array_merge(
-            $record['extra'],
-            array(
-                'memory_peak_usage' => $formatted,
-            )
-        );
-
-        return $record;
-    }
-}

+ 0 - 50
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Processor/MemoryProcessor.php

@@ -1,50 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-/**
- * Some methods that are common for all memory processors
- *
- * @author Rob Jensen
- */
-abstract class MemoryProcessor
-{
-    protected $realUsage;
-
-    /**
-     * @param boolean $realUsage
-     */
-    public function __construct($realUsage = true)
-    {
-        $this->realUsage = (boolean) $realUsage;
-    }
-
-    /**
-     * Formats bytes into a human readable string
-     *
-     * @param  int    $bytes
-     * @return string
-     */
-    protected static function formatBytes($bytes)
-    {
-        $bytes = (int) $bytes;
-
-        if ($bytes > 1024*1024) {
-            return round($bytes/1024/1024, 2).' MB';
-        } elseif ($bytes > 1024) {
-            return round($bytes/1024, 2).' KB';
-        }
-
-        return $bytes . ' B';
-    }
-
-}

+ 0 - 40
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Processor/MemoryUsageProcessor.php

@@ -1,40 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-/**
- * Injects memory_get_usage in all records
- *
- * @see Monolog\Processor\MemoryProcessor::__construct() for options
- * @author Rob Jensen
- */
-class MemoryUsageProcessor extends MemoryProcessor
-{
-    /**
-     * @param  array $record
-     * @return array
-     */
-    public function __invoke(array $record)
-    {
-        $bytes = memory_get_usage($this->realUsage);
-        $formatted = self::formatBytes($bytes);
-
-        $record['extra'] = array_merge(
-            $record['extra'],
-            array(
-                'memory_usage' => $formatted,
-            )
-        );
-
-        return $record;
-    }
-}

+ 0 - 42
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Processor/PsrLogMessageProcessor.php

@@ -1,42 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-/**
- * Processes a record's message according to PSR-3 rules
- *
- * It replaces {foo} with the value from $context['foo']
- *
- * @author Jordi Boggiano <[email protected]>
- */
-class PsrLogMessageProcessor
-{
-    /**
-     * @param  array $record
-     * @return array
-     */
-    public function __invoke(array $record)
-    {
-        if (false === strpos($record['message'], '{')) {
-            return $record;
-        }
-
-        $replacements = array();
-        foreach ($record['context'] as $key => $val) {
-            $replacements['{'.$key.'}'] = $val;
-        }
-
-        $record['message'] = strtr($record['message'], $replacements);
-
-        return $record;
-    }
-}

+ 0 - 66
frameworks/PHP/php-fuel/fuel/packages/log/src/Monolog/Processor/WebProcessor.php

@@ -1,66 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <[email protected]>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-/**
- * Injects url/method and remote IP of the current web request in all records
- *
- * @author Jordi Boggiano <[email protected]>
- */
-class WebProcessor
-{
-    protected $serverData;
-
-    /**
-     * @param mixed $serverData array or object w/ ArrayAccess that provides access to the $_SERVER data
-     */
-    public function __construct($serverData = null)
-    {
-        if (null === $serverData) {
-            $this->serverData =& $_SERVER;
-        } elseif (is_array($serverData) || $serverData instanceof \ArrayAccess) {
-            $this->serverData = $serverData;
-        } else {
-            throw new \UnexpectedValueException('$serverData must be an array or object implementing ArrayAccess.');
-        }
-    }
-
-    /**
-     * @param  array $record
-     * @return array
-     */
-    public function __invoke(array $record)
-    {
-        // skip processing if for some reason request data
-        // is not present (CLI or wonky SAPIs)
-        if (!isset($this->serverData['REQUEST_URI'])) {
-            return $record;
-        }
-
-        if (!isset($this->serverData['HTTP_REFERER'])) {
-            $this->serverData['HTTP_REFERER'] = null;
-        }
-
-        $record['extra'] = array_merge(
-            $record['extra'],
-            array(
-                'url'         => $this->serverData['REQUEST_URI'],
-                'ip'          => $this->serverData['REMOTE_ADDR'],
-                'http_method' => $this->serverData['REQUEST_METHOD'],
-                'server'      => $this->serverData['SERVER_NAME'],
-                'referrer'    => $this->serverData['HTTP_REFERER'],
-            )
-        );
-
-        return $record;
-    }
-}