src/logging/Logger.ts   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 4

Size

Lines of Code 25
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 19
mnd 3
bc 3
fnc 1
dl 0
loc 25
ccs 11
cts 11
cp 1
rs 10
bpm 3
cpm 4
noi 0
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A Logger.ts ➔ createLogger 0 21 4
1 7
import pretty from 'pino-pretty';
2 7
import pino from 'pino';
3
4 7
export default function createLogger(scope?: string) {
5 7
  const logger = pino(
6
    {
7
      msgPrefix: `[${scope ?? 'ExpressBeans'}] `,
8
    },
9
    pretty({
10
      singleLine: true,
11
    }),
12
  );
13 7
  switch (process.env.NODE_ENV) {
14
  case 'production':
15 1
    logger.level = 'info';
16 1
    break;
17
  case 'test':
18 5
    logger.level = 'silent';
19 5
    break;
20
  default:
21 1
    logger.level = 'debug';
22
  }
23 7
  return logger;
24
}
25