Passed
Push — develop ( d4fe34...f94e96 )
by Lorenzo
02:08 queued 13s
created

src/logging/decorators/InjectLogger.ts   A

Complexity

Total Complexity 3
Complexity/F 3

Size

Lines of Code 15
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
mnd 2
bc 2
fnc 1
dl 0
loc 15
bpm 2
cpm 3
noi 0
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10

1 Function

Rating   Name   Duplication   Size   Complexity  
A InjectLogger.ts ➔ InjectLogger 0 10 3
1
import { logger } from '@/core';
2
import Logger from '@/logging/Logger';
3
4
/**
5
 * Initializes a Logger with a specified prefix message
6
 * @decorator
7
 * @param scope {string}
8
 */
9
export function InjectLogger(scope?: string) {
10 2
  return (_value: any, _context: ClassFieldDecoratorContext) => () => {
11 3
    logger.debug(`initializing ${scope ?? 'anonymous'} logger`);
12 3
    return Logger(scope);
13
  };
14
}
15