mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
1081b9d865
This allows the users of 'unleash-server' to programatically change the logger implemnentation. #175
23 lines
607 B
JavaScript
23 lines
607 B
JavaScript
'use strict';
|
|
|
|
const { test } = require('ava');
|
|
const createLogger = require('./logger');
|
|
const logger = require('../logger');
|
|
const sinon = require('sinon');
|
|
|
|
test('should expose a setLoggerProvider function', t => {
|
|
t.true(logger.setLoggerProvider instanceof Function);
|
|
});
|
|
|
|
test('should create logger via custom logger provider', t => {
|
|
const provider = sinon.stub();
|
|
const loggerName = 'test';
|
|
const loggerImpl = {};
|
|
provider.withArgs(loggerName).returns(loggerImpl);
|
|
logger.setLoggerProvider(provider);
|
|
|
|
const log = createLogger(loggerName);
|
|
|
|
t.is(log, loggerImpl);
|
|
});
|