33/**
44 * https://github.com/ggrachdev/BitrixDebugger
556- * @version 0.02
6+ * @version 0.03 beta
77 *
88 * Пример дебага:
99 *
10- * GD ()->notice('Моя переменная', 'Моя переменная 2');
11- * GD ()->error('Моя переменная', 'Моя переменная 2');
12- * GD ()->warning('Моя переменная', 'Моя переменная 2');
13- * GD ()->success('Моя переменная', 'Моя переменная 2');
10+ * DD ()->notice('Моя переменная', 'Моя переменная 2');
11+ * DD ()->error('Моя переменная', 'Моя переменная 2');
12+ * DD ()->warning('Моя переменная', 'Моя переменная 2');
13+ * DD ()->success('Моя переменная', 'Моя переменная 2');
1414 *
1515 * Залогировать в файлы
16- * GD ()->noticeLog('Моя переменная', 'Моя переменная 2');
17- * GD ()->errorLog('Моя переменная', 'Моя переменная 2');
18- * GD ()->warningLog('Моя переменная', 'Моя переменная 2');
19- * GD ()->successLog('Моя переменная', 'Моя переменная 2');
16+ * DD ()->noticeLog('Моя переменная', 'Моя переменная 2');
17+ * DD ()->errorLog('Моя переменная', 'Моя переменная 2');
18+ * DD ()->warningLog('Моя переменная', 'Моя переменная 2');
19+ * DD ()->successLog('Моя переменная', 'Моя переменная 2');
2020 *
2121 * Нужно подключить этот файл в init.php
2222 * include 'BitrixDebugger/initializer.php';
2323 *
2424 */
25- use Bitrix \Main \Page \Asset ;
26-
27- if (!empty ($ _SERVER ['DOCUMENT_ROOT ' ])) {
28-
29- $ ggrachDebuggerRootPath = str_replace ($ _SERVER ['DOCUMENT_ROOT ' ], '' , __DIR__ );
30-
31- \Bitrix \Main \Loader::registerAutoLoadClasses (null , [
32- "\GGrach\BitrixDebugger\Debugger\Debugger " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Debugger/Debugger.php " ,
33- "\GGrach\BitrixDebugger\Debugger\DebuggerShowModable " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Debugger/DebuggerShowModable.php " ,
34- "\GGrach\BitrixDebugger\Contract\ShowModableContract " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Contract/ShowModableContract.php " ,
35- "\GGrach\BitrixDebugger\Configurator\DebuggerConfigurator " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Configurator/DebuggerConfigurator.php " ,
36- "\GGrach\BitrixDebugger\Configurator\DebugBarConfigurator " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Configurator/DebugBarConfigurator.php " ,
37- "\GGrach\BitrixDebugger\Cache\RuntimeCache " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Cache/RuntimeCache.php " ,
38- "\GGrach\BitrixDebugger\Validator\ShowModeDebuggerValidator " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Validator/ShowModeDebuggerValidator.php " ,
39- "\GGrach\BitrixDebugger\Representer\DebugBarRepresenter " => $ ggrachDebuggerRootPath . "/src/BitrixDebugger/Representer/DebugBarRepresenter.php " ,
40- "\GGrach\Writer\FileWriter " => $ ggrachDebuggerRootPath . "/src/Writer/FileWriter.php " ,
41- "\GGrach\Writer\Contract\WritableContract " => $ ggrachDebuggerRootPath . "/src/Writer/Contract/WritableContract.php "
42- ]);
43-
44- $ ggrachDebuggerConfigurator = new \GGrach \BitrixDebugger \Configurator \DebuggerConfigurator ();
45- $ ggrachDebugBarConfigurator = new \GGrach \BitrixDebugger \Configurator \DebugBarConfigurator ();
46-
47- $ ggrachDebuggerConfigurator ->setLogPath ('error ' , __DIR__ . '/logs/error.log ' );
48- $ ggrachDebuggerConfigurator ->setLogPath ('warning ' , __DIR__ . '/logs/warning.log ' );
49- $ ggrachDebuggerConfigurator ->setLogPath ('success ' , __DIR__ . '/logs/success.log ' );
50- $ ggrachDebuggerConfigurator ->setLogPath ('notice ' , __DIR__ . '/logs/notice.log ' );
51-
52- global $ GD ;
53- $ GD = new \GGrach \BitrixDebugger \Debugger \Debugger ($ ggrachDebuggerConfigurator , $ ggrachDebugBarConfigurator );
54-
55- /*
56- * code - отображать дебаг-данные в коде
57- * debug_bar - отображать дебаг-данные в debug_bar
58- */
59- $ GD ->setShowModes (['code ' , 'debug_bar ' ]);
60-
61- function GD () {
62- global $ GD ;
63- return $ GD ;
64- }
65-
66- if (\GGrach \BitrixDebugger \Validator \ShowModeDebuggerValidator::needShowInDebugBar ($ GD )) {
67-
68- Asset::getInstance ()->addJs ($ ggrachDebuggerRootPath . "/assets/DebugBar/js/initializer.js " );
69- Asset::getInstance ()->addCss ($ ggrachDebuggerRootPath . '/assets/DebugBar/themes/general.css ' );
70- Asset::getInstance ()->addCss ($ ggrachDebuggerRootPath . '/assets/DebugBar/themes/ ' . $ ggrachDebugBarConfigurator ->getColorTheme () . '/theme.css ' );
71-
72- include 'functions.php ' ;
73-
74- include 'events.php ' ;
75- }
25+ if (\php_sapi_name () === 'cli ' ) {
26+ include 'initializers/cli.php ' ;
27+ } else {
28+ include 'initializers/server.php ' ;
7629}
0 commit comments