Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(getLogger): remove getLogger and LoggerFactory from the API #1385

Merged
merged 1 commit into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/stryker-api/logging.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
export { default as LoggerFactory } from './src/logging/LoggerFactory';
export { default as Logger } from './src/logging/Logger';
export { default as LoggerFactoryMethod } from './src/logging/LoggerFactoryMethod';
export { default as getLogger } from './src/logging/getLogger';
31 changes: 0 additions & 31 deletions packages/stryker-api/src/logging/LoggerFactory.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/stryker-api/src/logging/getLogger.ts

This file was deleted.

19 changes: 0 additions & 19 deletions packages/stryker-javascript-mutator/test/helpers/LogMock.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/stryker-javascript-mutator/test/helpers/initSinon.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import * as sinon from 'sinon';
import * as logging from 'stryker-api/logging';
import LogMock from './LogMock';

beforeEach(() => {
global.sandbox = sinon.createSandbox();
global.logMock = new LogMock();
global.sandbox.stub(logging, 'getLogger').returns(global.logMock);
});

afterEach(() => {
Expand Down
8 changes: 0 additions & 8 deletions packages/stryker/src/logging/LogConfigurator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as log4js from 'log4js';
import { LoggerFactory } from 'stryker-api/logging';
import { LogLevel } from 'stryker-api/core';
import { minLevel } from './logUtils';
import LoggingClientContext from './LoggingClientContext';
Expand Down Expand Up @@ -74,17 +73,12 @@ export default class LogConfigurator {
};
}

private static setImplementation(): void {
LoggerFactory.setLogImplementation(log4js.getLogger);
}

/**
* Configure logging for the master process. Either call this method or `configureChildProcess` before any `getLogger` calls.
* @param consoleLogLevel The log level to configure for the console
* @param fileLogLevel The log level to configure for the "stryker.log" file
*/
public static configureMainProcess(consoleLogLevel: LogLevel = LogLevel.Information, fileLogLevel: LogLevel = LogLevel.Off, allowConsoleColors: boolean = true) {
this.setImplementation();
const appenders = this.createMainProcessAppenders(consoleLogLevel, fileLogLevel, allowConsoleColors);
log4js.configure(this.createLog4jsConfig(minLevel(consoleLogLevel, fileLogLevel), appenders));
}
Expand All @@ -99,7 +93,6 @@ export default class LogConfigurator {
* @returns the context
*/
public static async configureLoggingServer(consoleLogLevel: LogLevel, fileLogLevel: LogLevel, allowConsoleColors: boolean): Promise<LoggingClientContext> {
this.setImplementation();
const loggerPort = await getFreePort();

// Include the appenders for the main Stryker process, as log4js has only one single `configure` method.
Expand Down Expand Up @@ -127,7 +120,6 @@ export default class LogConfigurator {
* @param context the logging client context used to configure the logging client
*/
public static configureChildProcess(context: LoggingClientContext) {
this.setImplementation();
const clientAppender: log4js.MultiprocessAppender = { type: 'multiprocess', mode: 'worker', loggerPort: context.port };
const appenders: AppendersConfiguration = { [AppenderName.All]: clientAppender };
log4js.configure(this.createLog4jsConfig(context.level, appenders));
Expand Down