33// Need include this file in init.php
44
55use Bitrix \Main \Loader ;
6+ use Bitrix \Main \Page \Asset ;
67
78$ ggrachDebuggerRootPath = str_replace ($ _SERVER ['DOCUMENT_ROOT ' ], '' , __DIR__ );
89
2627$ ggrachDebuggerConfigurator ->setLogPath ('success ' , __DIR__ . '/logs/success.log ' );
2728$ ggrachDebuggerConfigurator ->setLogPath ('notice ' , __DIR__ . '/logs/notice.log ' );
2829
30+ global $ GD ;
31+ $ GD = new \GGrach \BitrixDebugger \Debugger \Debugger ($ ggrachDebuggerConfigurator , $ ggrachDebugBarConfigurator );
32+
2933/*
3034 * code - отображать дебаг-данные в коде
3135 * debug_bar - отображать дебаг-данные в debug_bar
3236 * log - отображать дебаг-данные в логе
3337 */
34- $ ggrachDebuggerConfigurator ->setShowModes (['code ' , 'debug_bar ' , 'log ' ]);
35-
36- global $ GD ;
37- $ GD = new \GGrach \BitrixDebugger \Debugger \Debugger ($ ggrachDebuggerConfigurator , $ ggrachDebugBarConfigurator );
38-
39- include 'inizializer_alias.php ' ;
38+ $ GD ->setShowModes (['code ' , 'debug_bar ' , 'log ' ]);
39+
40+ global $ USER ;
41+
42+ if ($ USER && $ USER ->IsAdmin ()) {
43+ Asset::getInstance ()->addJs ($ ggrachDebuggerRootPath . "/assets/DebugBar/js/initializer.js " );
44+ Asset::getInstance ()->addCss ($ ggrachDebuggerRootPath . "/assets/DebugBar/themes/ $ {$ ggrachDebugBarConfigurator ->getColorTheme ()}/fix.css " );
45+ }
46+
47+ /**
48+ * Пример дебага:
49+ *
50+ * $GD->notice("Моя переменная', 'Моя переменная 2');
51+ * $GD->error('Моя переменная', 'Моя переменная 2');
52+ * $GD->warning('Моя переменная', 'Моя переменная 2');
53+ * $GD->success('Моя переменная', 'Моя переменная 2');
54+ *
55+ */
56+ include 'inizializer_alias.php ' ;
0 commit comments