/
var
/
www
/
cobraambalaj
/
vendor
/
monolog
/
monolog
/
src
/
Monolog
/
Handler
/
/var/www/cobraambalaj/vendor/monolog/monolog/src/Monolog/Handler
mkdir
upload
Name
Size
Mode
Actions
Curl/
-
0755
rm
FingersCrossed/
-
0755
rm
Slack/
-
0755
rm
SyslogUdp/
-
0755
rm
AbstractHandler.php
2287
0644
edit
dl
rm
AbstractProcessingHandler.php
1433
0644
edit
dl
rm
AbstractSyslogHandler.php
3584
0644
edit
dl
rm
AmqpHandler.php
4038
0644
edit
dl
rm
BrowserConsoleHandler.php
7622
0644
edit
dl
rm
BufferHandler.php
4674
0644
edit
dl
rm
ChromePHPHandler.php
5252
0644
edit
dl
rm
CouchDBHandler.php
2032
0644
edit
dl
rm
CubeHandler.php
4849
0644
edit
dl
rm
DeduplicationHandler.php
5695
0644
edit
dl
rm
DoctrineCouchDBHandler.php
1098
0644
edit
dl
rm
DynamoDbHandler.php
2460
0644
edit
dl
rm
ElasticaHandler.php
3423
0644
edit
dl
rm
ElasticsearchHandler.php
5470
0644
edit
dl
rm
ErrorLogHandler.php
2512
0644
edit
dl
rm
FallbackGroupHandler.php
1385
0644
edit
dl
rm
FilterHandler.php
5937
0644
edit
dl
rm
FingersCrossedHandler.php
7716
0644
edit
dl
rm
FirePHPHandler.php
4897
0644
edit
dl
rm
FleepHookHandler.php
3319
0644
edit
dl
rm
FlowdockHandler.php
3254
0644
edit
dl
rm
FormattableHandlerInterface.php
845
0644
edit
dl
rm
FormattableHandlerTrait.php
1281
0644
edit
dl
rm
GelfHandler.php
1622
0644
edit
dl
rm
GroupHandler.php
3077
0644
edit
dl
rm
Handler.php
1029
0644
edit
dl
rm
HandlerInterface.php
2778
0644
edit
dl
rm
HandlerWrapper.php
3358
0644
edit
dl
rm
IFTTTHandler.php
2195
0644
edit
dl
rm
InsightOpsHandler.php
1895
0644
edit
dl
rm
LogEntriesHandler.php
1714
0644
edit
dl
rm
LogglyHandler.php
4240
0644
edit
dl
rm
LogmaticHandler.php
2502
0644
edit
dl
rm
MailHandler.php
2066
0644
edit
dl
rm
MandrillHandler.php
2700
0644
edit
dl
rm
MissingExtensionException.php
473
0644
edit
dl
rm
MongoDBHandler.php
2672
0644
edit
dl
rm
NativeMailerHandler.php
5165
0644
edit
dl
rm
NewRelicHandler.php
6366
0644
edit
dl
rm
NoopHandler.php
880
0644
edit
dl
rm
NullHandler.php
1142
0644
edit
dl
rm
OverflowHandler.php
4935
0644
edit
dl
rm
PHPConsoleHandler.php
10210
0644
edit
dl
rm
ProcessableHandlerInterface.php
1078
0644
edit
dl
rm
ProcessableHandlerTrait.php
1494
0644
edit
dl
rm
ProcessHandler.php
5423
0644
edit
dl
rm
PsrHandler.php
2651
0644
edit
dl
rm
PushoverHandler.php
7025
0644
edit
dl
rm
RedisHandler.php
3005
0644
edit
dl
rm
RedisPubSubHandler.php
1952
0644
edit
dl
rm
RollbarHandler.php
3550
0644
edit
dl
rm
RotatingFileHandler.php
6185
0644
edit
dl
rm
SamplingHandler.php
3988
0644
edit
dl
rm
SendGridHandler.php
2900
0644
edit
dl
rm
SlackHandler.php
6664
0644
edit
dl
rm
SlackWebhookHandler.php
4029
0644
edit
dl
rm
SocketHandler.php
9942
0644
edit
dl
rm
SqsHandler.php
1783
0644
edit
dl
rm
StreamHandler.php
5435
0644
edit
dl
rm
SwiftMailerHandler.php
3362
0644
edit
dl
rm
SyslogHandler.php
2003
0644
edit
dl
rm
SyslogUdpHandler.php
3852
0644
edit
dl
rm
TelegramBotHandler.php
5305
0644
edit
dl
rm
TestHandler.php
5766
0644
edit
dl
rm
WebRequestRecognizerTrait.php
524
0644
edit
dl
rm
WhatFailureGroupHandler.php
1533
0644
edit
dl
rm
ZendMonitorHandler.php
3185
0644
edit
dl
rm
Edit:
/var/www/cobraambalaj/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php
(7622B)
<?php declare(strict_types=1); /* * 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\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Formatter\FormatterInterface; use Monolog\Utils; /** * Handler sending logs to browser's javascript console with no browser extension required * * @author Olivier Poitrey <rs@dailymotion.com> */ class BrowserConsoleHandler extends AbstractProcessingHandler { protected static $initialized = false; protected static $records = []; /** * {@inheritDoc} * * Formatted output may contain some formatting markers to be transferred to `console.log` using the %c format. * * Example of formatted string: * * You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white} */ protected function getDefaultFormatter(): FormatterInterface { return new LineFormatter('[[%channel%]]{macro: autolabel} [[%level_name%]]{font-weight: bold} %message%'); } /** * {@inheritDoc} */ protected function write(array $record): void { // Accumulate records static::$records[] = $record; // Register shutdown handler if not already done if (!static::$initialized) { static::$initialized = true; $this->registerShutdownFunction(); } } /** * Convert records to javascript console commands and send it to the browser. * This method is automatically called on PHP shutdown if output is HTML or Javascript. */ public static function send(): void { $format = static::getResponseFormat(); if ($format === 'unknown') { return; } if (count(static::$records)) { if ($format === 'html') { static::writeOutput('<script>' . static::generateScript() . '</script>'); } elseif ($format === 'js') { static::writeOutput(static::generateScript()); } static::resetStatic(); } } public function close(): void { self::resetStatic(); } public function reset() { parent::reset(); self::resetStatic(); } /** * Forget all logged records */ public static function resetStatic(): void { static::$records = []; } /** * Wrapper for register_shutdown_function to allow overriding */ protected function registerShutdownFunction(): void { if (PHP_SAPI !== 'cli') { register_shutdown_function(['Monolog\Handler\BrowserConsoleHandler', 'send']); } } /** * Wrapper for echo to allow overriding */ protected static function writeOutput(string $str): void { echo $str; } /** * Checks the format of the response * * If Content-Type is set to application/javascript or text/javascript -> js * If Content-Type is set to text/html, or is unset -> html * If Content-Type is anything else -> unknown * * @return string One of 'js', 'html' or 'unknown' */ protected static function getResponseFormat(): string { // Check content type foreach (headers_list() as $header) { if (stripos($header, 'content-type:') === 0) { // This handler only works with HTML and javascript outputs // text/javascript is obsolete in favour of application/javascript, but still used if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) { return 'js'; } if (stripos($header, 'text/html') === false) { return 'unknown'; } break; } } return 'html'; } private static function generateScript(): string { $script = []; foreach (static::$records as $record) { $context = static::dump('Context', $record['context']); $extra = static::dump('Extra', $record['extra']); if (empty($context) && empty($extra)) { $script[] = static::call_array('log', static::handleStyles($record['formatted'])); } else { $script = array_merge( $script, [static::call_array('groupCollapsed', static::handleStyles($record['formatted']))], $context, $extra, [static::call('groupEnd')] ); } } return "(function (c) {if (c && c.groupCollapsed) {\n" . implode("\n", $script) . "\n}})(console);"; } private static function handleStyles(string $formatted): array { $args = []; $format = '%c' . $formatted; preg_match_all('/\[\[(.*?)\]\]\{([^}]*)\}/s', $format, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); foreach (array_reverse($matches) as $match) { $args[] = '"font-weight: normal"'; $args[] = static::quote(static::handleCustomStyles($match[2][0], $match[1][0])); $pos = $match[0][1]; $format = Utils::substr($format, 0, $pos) . '%c' . $match[1][0] . '%c' . Utils::substr($format, $pos + strlen($match[0][0])); } $args[] = static::quote('font-weight: normal'); $args[] = static::quote($format); return array_reverse($args); } private static function handleCustomStyles(string $style, string $string): string { static $colors = ['blue', 'green', 'red', 'magenta', 'orange', 'black', 'grey']; static $labels = []; return preg_replace_callback('/macro\s*:(.*?)(?:;|$)/', function (array $m) use ($string, &$colors, &$labels) { if (trim($m[1]) === 'autolabel') { // Format the string as a label with consistent auto assigned background color if (!isset($labels[$string])) { $labels[$string] = $colors[count($labels) % count($colors)]; } $color = $labels[$string]; return "background-color: $color; color: white; border-radius: 3px; padding: 0 2px 0 2px"; } return $m[1]; }, $style); } private static function dump(string $title, array $dict): array { $script = []; $dict = array_filter($dict); if (empty($dict)) { return $script; } $script[] = static::call('log', static::quote('%c%s'), static::quote('font-weight: bold'), static::quote($title)); foreach ($dict as $key => $value) { $value = json_encode($value); if (empty($value)) { $value = static::quote(''); } $script[] = static::call('log', static::quote('%s: %o'), static::quote((string) $key), $value); } return $script; } private static function quote(string $arg): string { return '"' . addcslashes($arg, "\"\n\\") . '"'; } private static function call(...$args): string { $method = array_shift($args); return static::call_array($method, $args); } private static function call_array(string $method, array $args): string { return 'c.' . $method . '(' . implode(', ', $args) . ');'; } }
Save
cmd:
run