jest . mock ( '../lib/level_logger' ) ; import { loggingSystemMock } from 'src/core/server/mocks' ; import { LevelLogger } from '../lib/level_logger' ; export function createMockLevelLogger ( ) { const consoleLogger = ( tag ) => ( message ) => console . log ( tag , message ) ; const logger = new LevelLogger ( loggingSystemMock . create ( ) ) as jest . Mocked < LevelLogger > ; logger . info . mockImplementation ( consoleLogger ( 'info' ) ) ; logger . warn . mockImplementation ( consoleLogger ( 'warn' ) ) ; logger . warning = jest . fn ( ) . mockImplementation ( consoleLogger ( 'warn' ) ) ; logger . error . mockImplementation ( consoleLogger ( 'error' ) ) ; logger . trace . mockImplementation ( consoleLogger ( 'trace' ) ) ; logger . clone . mockImplementation ( ( ) => logger ) ; return logger ; }