Skip to content

Commit

Permalink
removed FireLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jul 22, 2022
1 parent e953200 commit d04000f
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 410 deletions.
45 changes: 0 additions & 45 deletions examples/firelogger.php

This file was deleted.

29 changes: 0 additions & 29 deletions readme.md
Expand Up @@ -343,35 +343,6 @@ echo Debugger::timer(); // elapsed time in seconds
```


FireLogger
----------

You cannot always send debugging information to the browser window. This applies to AJAX requests or generating XML files to output. In such cases, you can send the messages by a separate channel into FireLogger. Error, Notice and Warning levels are sent to FireLogger window automatically. It is also possible to log suppressed exceptions in running application when attention to them is important.

How to do it?

- install extension [FireLogger for Chrome](https://chrome.google.com/webstore/detail/firelogger-for-chrome/hmagilfopmdjkeomnjpchokglfdfjfeh)
- turn on Chrome DevTools (using Ctrl-Shift-I key) and open Console

Navigate to the [demo page](https://examples.nette.org/tracy/) and you will see messages sent from PHP.

Because Tracy\Debugger communicates with FireLogger via HTTP headers, you must call the logging function before the PHP script sends anything to output. It is also possible to enable output buffering and delay the output.

```php
use Tracy\Debugger;

Debugger::fireLog('Hello World'); // send string into FireLogger console

Debugger::fireLog($_SERVER); // or even arrays and objects

Debugger::fireLog(new Exception('Test Exception')); // or exceptions
```

The result looks like this:

![FireLogger](https://nette.github.io/tracy/images/tracy-firelogger.png)


Custom Logger
-------------

Expand Down
31 changes: 1 addition & 30 deletions src/Tracy/Debugger/Debugger.php
Expand Up @@ -33,9 +33,6 @@ class Debugger
/** @var bool whether to display debug bar in development mode */
public static $showBar = true;

/** @var bool whether to send data to FireLogger in development mode */
public static $showFireLogger = true;

/** @var int size of reserved memory */
public static $reservedMemorySize = 500000;

Expand Down Expand Up @@ -96,7 +93,7 @@ class Debugger
/** @var string|array email(s) to which send error notifications */
public static $email;

/** for Debugger::log() and Debugger::fireLog() */
/** for Debugger::log() */
public const
DEBUG = ILogger::DEBUG,
INFO = ILogger::INFO,
Expand Down Expand Up @@ -145,9 +142,6 @@ class Debugger
/** @var ILogger */
private static $logger;

/** @var ILogger */
private static $fireLogger;

/** @var array{DevelopmentStrategy, ProductionStrategy} */
private static $strategy;

Expand Down Expand Up @@ -236,7 +230,6 @@ public static function enable($mode = null, ?string $logDirectory = null, $email
'Dumper/Exposer',
'Dumper/Renderer',
'Dumper/Value',
'Logger/FireLogger',
'Logger/Logger',
'Session/SessionStorage',
'Session/FileSession',
Expand Down Expand Up @@ -435,16 +428,6 @@ public static function getLogger(): ILogger
}


public static function getFireLogger(): ILogger
{
if (!self::$fireLogger) {
self::$fireLogger = new FireLogger;
}

return self::$fireLogger;
}


/** @return ProductionStrategy|DevelopmentStrategy @internal */
public static function getStrategy()
{
Expand Down Expand Up @@ -575,18 +558,6 @@ public static function log($message, string $level = ILogger::INFO)
}


/**
* Sends message to FireLogger console.
* @param mixed $message
*/
public static function fireLog($message): bool
{
return !self::$productionMode && self::$showFireLogger
? self::getFireLogger()->log($message)
: false;
}


/** @internal */
public static function addSourceMapper(callable $mapper): void
{
Expand Down
8 changes: 2 additions & 6 deletions src/Tracy/Debugger/DevelopmentStrategy.php
Expand Up @@ -49,7 +49,6 @@ public function handleException(\Throwable $exception, bool $firstTime): void
$this->blueScreen->render($exception);

} else {
Debugger::fireLog($exception);
$this->renderExceptionCli($exception);
}
}
Expand Down Expand Up @@ -102,11 +101,8 @@ public function handleError(
$message = 'PHP ' . Helpers::errorTypeToString($severity) . ': ' . Helpers::improveError($message);
$count = &$this->bar->getPanel('Tracy:errors')->data["$file|$line|$message"];

if (!$count++) { // not repeated error
Debugger::fireLog(new ErrorException($message, 0, $severity, $file, $line));
if (!Helpers::isHtmlMode() && !Helpers::isAjax()) {
echo "\n$message in $file on line $line\n";
}
if (!$count++ && !Helpers::isHtmlMode() && !Helpers::isAjax()) {
echo "\n$message in $file on line $line\n";
}

if (function_exists('ini_set')) {
Expand Down
187 changes: 0 additions & 187 deletions src/Tracy/Logger/FireLogger.php

This file was deleted.

1 change: 0 additions & 1 deletion src/tracy.php
Expand Up @@ -18,7 +18,6 @@
require __DIR__ . '/Tracy/Dumper/Exposer.php';
require __DIR__ . '/Tracy/Dumper/Renderer.php';
require __DIR__ . '/Tracy/Logger/ILogger.php';
require __DIR__ . '/Tracy/Logger/FireLogger.php';
require __DIR__ . '/Tracy/Logger/Logger.php';
require __DIR__ . '/Tracy/Debugger/Debugger.php';
require __DIR__ . '/Tracy/Debugger/DeferredContent.php';
Expand Down

0 comments on commit d04000f

Please sign in to comment.