summaryrefslogtreecommitdiff
path: root/vendor/monolog/monolog/src/Monolog/Processor
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/monolog/monolog/src/Monolog/Processor')
-rw-r--r--vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php64
-rw-r--r--vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php82
-rw-r--r--vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php40
-rw-r--r--vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php63
-rw-r--r--vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php40
-rw-r--r--vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php31
-rw-r--r--vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php48
-rw-r--r--vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php34
-rw-r--r--vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php38
-rw-r--r--vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php105
10 files changed, 0 insertions, 545 deletions
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php
deleted file mode 100644
index 1899400d..00000000
--- a/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-use Monolog\Logger;
-
-/**
- * Injects Git branch and Git commit SHA in all records
- *
- * @author Nick Otter
- * @author Jordi Boggiano <j.boggiano@seld.be>
- */
-class GitProcessor
-{
- private $level;
- private static $cache;
-
- public function __construct($level = Logger::DEBUG)
- {
- $this->level = Logger::toMonologLevel($level);
- }
-
- /**
- * @param array $record
- * @return array
- */
- public function __invoke(array $record)
- {
- // return if the level is not high enough
- if ($record['level'] < $this->level) {
- return $record;
- }
-
- $record['extra']['git'] = self::getGitInfo();
-
- return $record;
- }
-
- private static function getGitInfo()
- {
- if (self::$cache) {
- return self::$cache;
- }
-
- $branches = `git branch -v --no-abbrev`;
- if (preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) {
- return self::$cache = array(
- 'branch' => $matches[1],
- 'commit' => $matches[2],
- );
- }
-
- return self::$cache = array();
- }
-}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php
deleted file mode 100644
index 294a295c..00000000
--- a/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-use Monolog\Logger;
-
-/**
- * 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 <j.boggiano@seld.be>
- */
-class IntrospectionProcessor
-{
- private $level;
-
- private $skipClassesPartials;
-
- public function __construct($level = Logger::DEBUG, array $skipClassesPartials = array('Monolog\\'))
- {
- $this->level = Logger::toMonologLevel($level);
- $this->skipClassesPartials = $skipClassesPartials;
- }
-
- /**
- * @param array $record
- * @return array
- */
- public function __invoke(array $record)
- {
- // return if the level is not high enough
- if ($record['level'] < $this->level) {
- return $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'])) {
- foreach ($this->skipClassesPartials as $part) {
- if (strpos($trace[$i]['class'], $part) !== false) {
- $i++;
- continue 2;
- }
- }
- break;
- }
-
- // 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;
- }
-}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php
deleted file mode 100644
index 552fd709..00000000
--- a/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * 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 = $this->formatBytes($bytes);
-
- $record['extra'] = array_merge(
- $record['extra'],
- array(
- 'memory_peak_usage' => $formatted,
- )
- );
-
- return $record;
- }
-}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php
deleted file mode 100644
index 0820def4..00000000
--- a/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * 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
-{
- /**
- * @var boolean If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported.
- */
- protected $realUsage;
-
- /**
- * @var boolean If true, then format memory size to human readable string (MB, KB, B depending on size)
- */
- protected $useFormatting;
-
- /**
- * @param boolean $realUsage Set this to true to get the real size of memory allocated from system.
- * @param boolean $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size)
- */
- public function __construct($realUsage = true, $useFormatting = true)
- {
- $this->realUsage = (boolean) $realUsage;
- $this->useFormatting = (boolean) $useFormatting;
- }
-
- /**
- * Formats bytes into a human readable string if $this->useFormatting is true, otherwise return $bytes as is
- *
- * @param int $bytes
- * @return string|int Formatted string if $this->useFormatting is true, otherwise return $bytes as is
- */
- protected function formatBytes($bytes)
- {
- $bytes = (int) $bytes;
-
- if (!$this->useFormatting) {
- return $bytes;
- }
-
- if ($bytes > 1024*1024) {
- return round($bytes/1024/1024, 2).' MB';
- } elseif ($bytes > 1024) {
- return round($bytes/1024, 2).' KB';
- }
-
- return $bytes . ' B';
- }
-}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php
deleted file mode 100644
index 0c4dd9ab..00000000
--- a/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * 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 = $this->formatBytes($bytes);
-
- $record['extra'] = array_merge(
- $record['extra'],
- array(
- 'memory_usage' => $formatted,
- )
- );
-
- return $record;
- }
-}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php
deleted file mode 100644
index 9d3f5590..00000000
--- a/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-/**
- * Adds value of getmypid into records
- *
- * @author Andreas Hörnicke
- */
-class ProcessIdProcessor
-{
- /**
- * @param array $record
- * @return array
- */
- public function __invoke(array $record)
- {
- $record['extra']['process_id'] = getmypid();
-
- return $record;
- }
-}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php
deleted file mode 100644
index c2686ce5..00000000
--- a/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * 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 <j.boggiano@seld.be>
- */
-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) {
- if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) {
- $replacements['{'.$key.'}'] = $val;
- } elseif (is_object($val)) {
- $replacements['{'.$key.'}'] = '[object '.get_class($val).']';
- } else {
- $replacements['{'.$key.'}'] = '['.gettype($val).']';
- }
- }
-
- $record['message'] = strtr($record['message'], $replacements);
-
- return $record;
- }
-}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php
deleted file mode 100644
index 2784cef4..00000000
--- a/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-/**
- * Adds a tags array into record
- *
- * @author Martijn Riemers
- */
-class TagProcessor
-{
- private $tags;
-
- public function __construct(array $tags = array())
- {
- $this->tags = $tags;
- }
-
- public function __invoke(array $record)
- {
- $record['extra']['tags'] = $this->tags;
-
- return $record;
- }
-}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php
deleted file mode 100644
index 80270d08..00000000
--- a/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Monolog\Processor;
-
-/**
- * Adds a unique identifier into records
- *
- * @author Simon Mönch <sm@webfactory.de>
- */
-class UidProcessor
-{
- private $uid;
-
- public function __construct($length = 7)
- {
- if (!is_int($length) || $length > 32 || $length < 1) {
- throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32');
- }
-
- $this->uid = substr(hash('md5', uniqid('', true)), 0, $length);
- }
-
- public function __invoke(array $record)
- {
- $record['extra']['uid'] = $this->uid;
-
- return $record;
- }
-}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php
deleted file mode 100644
index 21f22a6e..00000000
--- a/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-
-/*
- * This file is part of the Monolog package.
- *
- * (c) Jordi Boggiano <j.boggiano@seld.be>
- *
- * 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 <j.boggiano@seld.be>
- */
-class WebProcessor
-{
- /**
- * @var array|\ArrayAccess
- */
- protected $serverData;
-
- /**
- * @var array
- */
- protected $extraFields = array(
- 'url' => 'REQUEST_URI',
- 'ip' => 'REMOTE_ADDR',
- 'http_method' => 'REQUEST_METHOD',
- 'server' => 'SERVER_NAME',
- 'referrer' => 'HTTP_REFERER',
- );
-
- /**
- * @param array|\ArrayAccess $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data
- * @param array|null $extraFields Extra field names to be added (all available by default)
- */
- public function __construct($serverData = null, array $extraFields = 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.');
- }
-
- if (null !== $extraFields) {
- foreach (array_keys($this->extraFields) as $fieldName) {
- if (!in_array($fieldName, $extraFields)) {
- unset($this->extraFields[$fieldName]);
- }
- }
- }
- }
-
- /**
- * @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;
- }
-
- $record['extra'] = $this->appendExtraFields($record['extra']);
-
- return $record;
- }
-
- /**
- * @param string $extraName
- * @param string $serverName
- * @return $this
- */
- public function addExtraField($extraName, $serverName)
- {
- $this->extraFields[$extraName] = $serverName;
-
- return $this;
- }
-
- /**
- * @param array $extra
- * @return array
- */
- private function appendExtraFields(array $extra)
- {
- foreach ($this->extraFields as $extraName => $serverName) {
- $extra[$extraName] = isset($this->serverData[$serverName]) ? $this->serverData[$serverName] : null;
- }
-
- if (isset($this->serverData['UNIQUE_ID'])) {
- $extra['unique_id'] = $this->serverData['UNIQUE_ID'];
- }
-
- return $extra;
- }
-}