Skip to content

Commit

Permalink
fix debug log issue -> increase logging system for next versions
Browse files Browse the repository at this point in the history
  • Loading branch information
thomrick committed Jul 6, 2017
1 parent b55e751 commit 6ec6b66
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/core/update/updaters/nest.updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import {Logger} from '../../../common/logger/interfaces/logger.interface';
import {LoggerService} from '../../logger/logger.service';

export class NestUpdater implements Updater {
private _logger: Logger = LoggerService.getLogger();
private NEST_DEPENDENCIES: string[] = [
'@nestjs/common',
'@nestjs/core',
'@nestjs/microservices',
'@nestjs/testing',
'@nestjs/websockets'
];
private _logger: Logger = LoggerService.getLogger();

constructor() {}

Expand Down
7 changes: 2 additions & 5 deletions src/lib/handlers/tests/update-command.handler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@ describe('UpdateCommandHandler', () => {
beforeEach(() => sandbox = sinon.sandbox.create());
afterEach(() => sandbox.restore());

let processor: Processor;
beforeEach(() => processor = new UpdateProcessor());

let setLoggerStub: sinon.SinonStub;
let processStub: sinon.SinonStub;
beforeEach(() => {
setLoggerStub = sandbox.stub(LoggerService, 'setLogger');
processStub = sandbox.stub(processor, 'processV2').callsFake(() => Promise.resolve());
processStub = sandbox.stub(UpdateProcessor.prototype, 'processV2').callsFake(() => Promise.resolve());
});

let handler: CommandHandler;
beforeEach(() => handler = new UpdateCommandHandler(processor));
beforeEach(() => handler = new UpdateCommandHandler());

describe('#execute()', () => {
const args: UpdateCommandArguments = {};
Expand Down
6 changes: 1 addition & 5 deletions src/lib/handlers/update-command.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ import {Processor} from '../../common/asset/interfaces/processor.interface';
import {UpdateProcessor} from '../../core/update/processors/update.processor';

export class UpdateCommandHandler implements CommandHandler {
constructor(
private _processor: Processor = new UpdateProcessor()
) {}

public execute(args: UpdateCommandArguments, options: UpdateCommandOptions, logger: Logger): Promise<void> {
LoggerService.setLogger(logger);
logger.debug(ColorService.blue('[DEBUG]'), 'execute update command');
logger.debug(ColorService.blue('[DEBUG]'), 'arguments :', JSON.stringify(args, null, 2));
logger.debug(ColorService.blue('[DEBUG]'), 'options :', JSON.stringify(options, null, 2));
return this._processor.processV2(args, options);
return new UpdateProcessor().processV2(args, options);
}

}

0 comments on commit 6ec6b66

Please sign in to comment.