2020-03-29 13:43:52 +00:00
|
|
|
import { ConsoleLogger, Logger, NullLogger } from 'noicejs';
|
2020-03-30 23:23:53 +00:00
|
|
|
import { isDebug } from './utils/Env';
|
2020-03-29 13:43:52 +00:00
|
|
|
|
|
|
|
export function getTestLogger(verbose = false): Logger {
|
2020-03-30 23:23:53 +00:00
|
|
|
if (verbose || isDebug()) {
|
|
|
|
return ConsoleLogger.global;
|
2020-03-29 13:43:52 +00:00
|
|
|
} else {
|
2020-03-30 23:23:53 +00:00
|
|
|
return NullLogger.global;
|
2020-03-29 13:43:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function spyLogger(spies: Partial<Logger>): Logger {
|
|
|
|
const logger = {
|
|
|
|
...spies,
|
|
|
|
child: () => logger,
|
|
|
|
} as Logger;
|
|
|
|
return logger;
|
|
|
|
}
|