Skip to content

Commit b80813a

Browse files
committed
MAGE-1105 Add constant for namespace depth
1 parent 7e35165 commit b80813a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Logger/DiagnosticsLogger.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class DiagnosticsLogger
1717
/** @var array */
1818
protected const ALGOLIA_TAGS = ['group' => 'algolia'];
1919
protected const PROFILE_LOG_MESSAGES_DEFAULT = false;
20+
protected const DEFAULT_NAMESPACE_DEPTH = 2;
21+
2022
protected bool $isLoggerEnabled = false;
2123
protected bool $isProfilerEnabled = false;
2224

@@ -140,12 +142,12 @@ protected function getCallingMethodName(int $level = 2): ?string
140142
: null;
141143
}
142144

143-
protected function simplifyMethodName(string $methodName, int $namespaceDepth = 2): string
145+
protected function simplifyMethodName(string $methodName, int $namespaceDepth = self::DEFAULT_NAMESPACE_DEPTH): string
144146
{
145147
$separator = '\\';
146148
$parts = explode($separator, $methodName);
147149

148-
if (count($parts) <= $namespaceDepth) {
150+
if (count($parts) <= abs($namespaceDepth)) {
149151
return $methodName;
150152
}
151153

0 commit comments

Comments
 (0)