@@ -64,25 +64,23 @@ public function getCapabilities(bool $public = false, bool $initialState = false
6464
6565 // Only check execution time if debug mode is enabled
6666 $ debugMode = \OCP \Server::get (IConfig::class)->getSystemValueBool ('debug ' , false );
67- if ($ debugMode ) {
68- $ timeSpent = $ endTime - $ startTime ;
69- if ($ timeSpent > self ::ACCEPTABLE_LOADING_TIME ) {
70- $ logLevel = match (true ) {
71- $ timeSpent > self ::ACCEPTABLE_LOADING_TIME * 16 => ILogger::FATAL ,
72- $ timeSpent > self ::ACCEPTABLE_LOADING_TIME * 8 => ILogger::ERROR ,
73- $ timeSpent > self ::ACCEPTABLE_LOADING_TIME * 4 => ILogger::WARN ,
74- $ timeSpent > self ::ACCEPTABLE_LOADING_TIME * 2 => ILogger::INFO ,
75- default => ILogger::DEBUG ,
76- };
77- $ this ->logger ->log (
78- $ logLevel ,
79- 'Capabilities of {className} took {duration} seconds to generate. ' ,
80- [
81- 'className ' => get_class ($ c ),
82- 'duration ' => round ($ timeSpent , 2 ),
83- ]
84- );
85- }
67+ $ timeSpent = $ endTime - $ startTime ;
68+ if ($ debugMode && $ timeSpent > self ::ACCEPTABLE_LOADING_TIME ) {
69+ $ logLevel = match (true ) {
70+ $ timeSpent > self ::ACCEPTABLE_LOADING_TIME * 16 => ILogger::FATAL ,
71+ $ timeSpent > self ::ACCEPTABLE_LOADING_TIME * 8 => ILogger::ERROR ,
72+ $ timeSpent > self ::ACCEPTABLE_LOADING_TIME * 4 => ILogger::WARN ,
73+ $ timeSpent > self ::ACCEPTABLE_LOADING_TIME * 2 => ILogger::INFO ,
74+ default => ILogger::DEBUG ,
75+ };
76+ $ this ->logger ->log (
77+ $ logLevel ,
78+ 'Capabilities of {className} took {duration} seconds to generate. ' ,
79+ [
80+ 'className ' => get_class ($ c ),
81+ 'duration ' => round ($ timeSpent , 2 ),
82+ ]
83+ );
8684 }
8785 }
8886 } else {
0 commit comments