Skip to content

Commit

Permalink
feat(@angular-devkit/core): jobs should re-log instead of forwarding
Browse files Browse the repository at this point in the history
Current behaviour is to have logs forwarded, but this is flawed because on the
job side the logger is actually re-created. This allows logs to be actually part
of the caller side logging infrastructure.
hansl authored and Keen Yee Liau committed Feb 19, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 8196790 commit 7023255
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -101,7 +101,7 @@ export function createJobHandler<A extends JsonValue, I extends JsonValue, O ext
});

// Configure a logger to pass in as additional context.
const logger = new Logger('job');
const logger = new Logger('-internal-job-logger-');
const logSub = logger.subscribe(entry => {
subject.next({
kind: JobOutboundMessageKind.Log,
Original file line number Diff line number Diff line change
@@ -305,7 +305,7 @@ export class SimpleScheduler<
let state = JobState.Queued;
let pingId = 0;

const logger = options.logger ? options.logger.createChild('job') : new NullLogger();
const logger = options.logger ? options.logger : new NullLogger();

// Create the input channel by having a filter.
const input = new Subject<JsonValue>();
@@ -349,7 +349,8 @@ export class SimpleScheduler<

switch (message.kind) {
case JobOutboundMessageKind.Log:
logger.next(message.entry);
const entry = message.entry;
logger.log(entry.level, entry.message, entry);
break;

case JobOutboundMessageKind.ChannelCreate: {

0 comments on commit 7023255

Please sign in to comment.