public function onStartup(Application $app) { if (!extension_loaded('newrelic')) { return; } $oldLogger = Debugger::getLogger(); $logger = new Logger($oldLogger->directory, $oldLogger->email); $logger->emailSnooze = $oldLogger->emailSnooze; $logger->mailer = $oldLogger->mailer; Debugger::setLogger($logger); }
/** * @return Logger */ public static function getLogger() { if (!static::$logger) { static::$logger = new Logger(static::$logDirectory, static::$email, static::getBlueScreen()); static::$logger->directory =& Tracy\Debugger::$logDirectory; // back compatiblity static::$logger->email =& Tracy\Debugger::$email; Tracy\Debugger::setLogger(static::$logger); } return Tracy\Debugger::getLogger(); }
/** * @param Container $app * * @return mixed * * @throws DependencyInstanceNotFound */ public function register(Container $app) { /** @var Application $app */ $config = $this->config; // this service provider will quietly fail if Tracy is not installed. if (class_exists('\\Tracy\\Debugger') and $config->get('logging.tracy.enabled')) { // use the environment to configure the Debugger $env = env('APP_ENV') === 'PRODUCTION' ? Debugger::PRODUCTION : Debugger::DEVELOPMENT; Debugger::$maxDepth = $config->get('logging.tracy.maxDepth', 6); Debugger::enable($env, rtrim($config->get('logging.logPath', LOGS), '/')); Debugger::$showLocation = env('DEBUG') and $config->get('logging.tracy.showLocation', FALSE); Debugger::$strictMode = $config->get('logging.tracy.strictMode', FALSE); Debugger::$showBar = FALSE; # env('DEBUG'); // use the Tracy Debugger for logging. $app['tracy'] = Debugger::getLogger(); $app['nine.logger'] = function ($app) { return $app['tracy']; }; } }
/** * @param Nette\Application\Application $app */ public function onStartup(Nette\Application\Application $app) { Consumerr::setUrl(Tracy\Debugger::$source); Consumerr::addExtension(NetteConsumerr::EXTENSION_NAME, NetteConsumerr::VERSION_CODE); if (class_exists('Nette\\Framework')) { Consumerr::addLibrary('nette-framework', Nette\Framework::VERSION_ID); } if (class_exists('Tracy\\Debugger') && property_exists('Tracy\\Debugger', 'version')) { $version = str_replace('-dev', ".99", Tracy\Debugger::$version); $version = explode(".", $version); Consumerr::addLibrary('tracy', $version[0] * 10000 + $version[1] * 100 + $version[2]); } $logger = $this->createLogger(); if (method_exists('Tracy\\Debugger', 'getLogger')) { Tracy\Debugger::setLogger($logger); Tracy\Debugger::getLogger()->directory =& Tracy\Debugger::$logDirectory; Tracy\Debugger::getLogger()->email =& Tracy\Debugger::$email; } else { Tracy\Debugger::$logger = $logger; Tracy\Debugger::$logger->directory =& Tracy\Debugger::$logDirectory; Tracy\Debugger::$logger->email =& Tracy\Debugger::$email; } }
<?php /** * @package Og * @version 0.1.0 * @author Greg Truesdell <*****@*****.**> */ use Og\Forge; use Og\Support\Util; use Tracy\Debugger; use Tracy\FireLogger; Debugger::$maxDepth = 6; Debugger::enable(Debugger::DEVELOPMENT, LOCAL_LOGS); Debugger::$showLocation = TRUE; $logger = Debugger::getLogger(); Forge::getInstance()->instance(['logger', FireLogger::class], $logger); /** * @param bool $raw * * @return string */ function elapsed_time_since_request($raw = FALSE) { return !$raw ? sprintf("%8.1f ms", (microtime(TRUE) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000) : (microtime(TRUE) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000; } /** * @param $index * * @return string */ function location_from_backtrace($index = 2)
/** * @param array $logLevels */ public function __construct(array $logLevels) { $this->oldLogger = \Tracy\Debugger::getLogger(); $this->logLevels = $logLevels; }
<?php use Arachne\Bootstrap\Configurator; use Tracy\Debugger; // Load autoloader generated by Composer require __DIR__ . '/../vendor/autoload.php'; // Normalized internal encoding mb_internal_encoding('UTF-8'); // Normalized locale settings $locale = 'en_US.UTF-8'; setlocale(LC_ALL, $locale); putenv('LC_ALL=' . $locale); $configurator = new Configurator(); $configurator->addParameters(['appDir' => __DIR__, 'wwwDir' => __DIR__ . '/../www']); $configurator->enableDebugger(__DIR__ . '/../log', '*****@*****.**'); Debugger::getLogger()->emailSnooze = '1 hour'; // Specify folder for cache $configurator->setTempDirectory(__DIR__ . '/../temp'); // Create Dependency Injection container from config.neon file $configurator->addConfig(__DIR__ . '/config/config.neon', false); return $configurator->createContainer();
}); Container::extensionMethod('addDateTimePicker', function (Container $container, $name, $label = NULL) { return $container[$name] = new Controls\DateTimePicker($label); }); Container::extensionMethod('addTypeahead', function (Container $container, $name, $label = NULL, $callback = NULL) { return $container[$name] = new Controls\Typeahead($label, $callback); }); $configurator = new Nette\Configurator(); if (DEV_MODE === TRUE) { $configurator->setDebugMode(TRUE); } elseif (isset($debugIPs)) { $configurator->setDebugMode($debugIPs); } $configurator->enableDebugger(DIR_ROOT . '/log', isset($debugMail) ? $debugMail : NULL); $configurator->setTempDirectory(DIR_ROOT . '/temp'); if (!isset($robotLoaderDirs)) { $robotLoaderDirs = []; } $robotLoaderDirs[] = DIR_VENDOR . '/cothema/'; $robotLoaderDirs[] = DIR_ROOT . '/app/'; $robotLoader = $configurator->createRobotLoader(); foreach ($robotLoaderDirs as $robotLoaderDirsOne) { $robotLoader->addDirectory($robotLoaderDirsOne); } $robotLoader->register(); $configurator->addConfig(__DIR__ . '/config/config.neon'); is_file(DIR_ROOT . '/app/config/config.neon') && $configurator->addConfig(DIR_ROOT . '/app/config/config.neon'); $configurator->addConfig(DIR_ROOT . '/app/config/config.local.neon'); $container = $configurator->createContainer(); \Tracy\Debugger::getLogger()->emailSnooze = isset($debugMailSnooze) ? $debugMailSnooze : '30 minutes'; return $container;
public function log($level, $msg) { Debugger::getLogger()->log($msg, self::LEVEL); }