diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-06-25 17:03:19 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-07-02 15:03:18 +0200 |
commit | 2ba0819243cfe5eedf148b6ff19d5070f1ff7844 (patch) | |
tree | 08aa972fb13182e132e5d9e97fd92216e79224db /lib/base.php | |
parent | 72b6db40435ce0407d0aafa626945d4f2380460f (diff) | |
download | nextcloud-server-2ba0819243cfe5eedf148b6ff19d5070f1ff7844.tar.gz nextcloud-server-2ba0819243cfe5eedf148b6ff19d5070f1ff7844.zip |
feat(occ): Add a --debug option to output all log levels to the output
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/base.php b/lib/base.php index 91ca87426e1..894d9b7279f 100644 --- a/lib/base.php +++ b/lib/base.php @@ -63,6 +63,7 @@ class OC { * check if Nextcloud runs in cli mode */ public static bool $CLI = false; + public static bool $CLI_DEBUG = false; public static \OC\Autoloader $loader; @@ -556,6 +557,12 @@ class OC { self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php'; self::$composerAutoloader->setApcuPrefix(null); + if (self::$CLI && ($key = array_search('--debug', $_SERVER['argv'])) !== false) { + self::$CLI_DEBUG = true; + } else { + self::$CLI_DEBUG = false; + } + try { self::initPaths(); // setup 3rdparty autoloader @@ -578,6 +585,11 @@ class OC { self::$server = new \OC\Server(\OC::$WEBROOT, self::$config); self::$server->boot(); + if (self::$CLI_DEBUG) { + $eventDispatcher = \OCP\Server::get(IEventDispatcher::class); + $eventDispatcher->addServiceListener(\OCP\Log\BeforeMessageLoggedEvent::class, \OC\Core\Listener\BeforeMessageLoggedEventListener::class); + } + $eventLogger = Server::get(\OCP\Diagnostics\IEventLogger::class); $eventLogger->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd); $eventLogger->start('boot', 'Initialize'); |