mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: configure logger during setup
This commit is contained in:
committed by
Ruben Taelman
parent
09ac83caa5
commit
aaa49219dc
@@ -1,5 +1,6 @@
|
||||
import { Setup } from '../../../src/init/Setup';
|
||||
import type { ResourceIdentifier } from '../../../src/ldp/representation/ResourceIdentifier';
|
||||
import { VoidLoggerFactory } from '../../../src/logging/VoidLoggerFactory';
|
||||
|
||||
describe('Setup', (): void => {
|
||||
let httpServer: any;
|
||||
@@ -16,7 +17,7 @@ describe('Setup', (): void => {
|
||||
httpServer = {
|
||||
listen: jest.fn(),
|
||||
};
|
||||
setup = new Setup(httpServer, store, aclManager, 'http://localhost:3000/', 3000);
|
||||
setup = new Setup(httpServer, store, aclManager, new VoidLoggerFactory(), 'http://localhost:3000/', 3000);
|
||||
});
|
||||
|
||||
it('starts an HTTP server.', async(): Promise<void> => {
|
||||
|
||||
20
test/unit/logging/LogUtil.test.ts
Normal file
20
test/unit/logging/LogUtil.test.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { LazyLogger } from '../../../src/logging/LazyLogger';
|
||||
import { LazyLoggerFactory } from '../../../src/logging/LazyLoggerFactory';
|
||||
import { getLoggerFor } from '../../../src/logging/LogUtil';
|
||||
import { VoidLogger } from '../../../src/logging/VoidLogger';
|
||||
|
||||
describe('LogUtil', (): void => {
|
||||
beforeEach(async(): Promise<void> => {
|
||||
LazyLoggerFactory.getInstance().setLoggerFactory(undefined);
|
||||
});
|
||||
|
||||
it('allows creating a lazy logger for a string label.', async(): Promise<void> => {
|
||||
expect(getLoggerFor('MyLabel')).toBeInstanceOf(LazyLogger);
|
||||
expect((getLoggerFor('MyLabel') as any).label).toEqual('MyLabel');
|
||||
});
|
||||
|
||||
it('allows creating a lazy logger for a class instance.', async(): Promise<void> => {
|
||||
expect(getLoggerFor(new VoidLogger())).toBeInstanceOf(LazyLogger);
|
||||
expect((getLoggerFor(new VoidLogger()) as any).label).toEqual('VoidLogger');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user