| 172 | } |
| 173 | |
| 174 | private cacheNamespacedLevel(namespace: string): string { |
| 175 | let cached = namespace; |
| 176 | |
| 177 | while (this.cachedNamespacedLevels[namespace] === undefined) { |
| 178 | const sep = cached.lastIndexOf(NAMESPACE_SEPARATOR); |
| 179 | |
| 180 | if (sep === -1) { |
| 181 | this.cachedNamespacedLevels[namespace] = this.level; |
| 182 | |
| 183 | return this.level; |
| 184 | } |
| 185 | |
| 186 | cached = cached.slice(0, sep); |
| 187 | this.cachedNamespacedLevels[namespace] = this.cachedNamespacedLevels[cached]; |
| 188 | } |
| 189 | |
| 190 | return this.cachedNamespacedLevels[namespace]; |
| 191 | } |
| 192 | |
| 193 | private log(level: settings.LogLevel, messageOrLambda: string | (() => string), namespace: string): void { |
| 194 | const nsLevel = this.cacheNamespacedLevel(namespace); |