Skip to content

Commit 7023255

Browse files
hanslKeen Yee Liau
authored and
Keen Yee Liau
committed
feat(@angular-devkit/core): jobs should re-log instead of forwarding
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.
1 parent 8196790 commit 7023255

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/angular_devkit/core/src/experimental/jobs/create-job-handler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export function createJobHandler<A extends JsonValue, I extends JsonValue, O ext
101101
});
102102

103103
// Configure a logger to pass in as additional context.
104-
const logger = new Logger('job');
104+
const logger = new Logger('-internal-job-logger-');
105105
const logSub = logger.subscribe(entry => {
106106
subject.next({
107107
kind: JobOutboundMessageKind.Log,

packages/angular_devkit/core/src/experimental/jobs/simple-scheduler.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ export class SimpleScheduler<
305305
let state = JobState.Queued;
306306
let pingId = 0;
307307

308-
const logger = options.logger ? options.logger.createChild('job') : new NullLogger();
308+
const logger = options.logger ? options.logger : new NullLogger();
309309

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

350350
switch (message.kind) {
351351
case JobOutboundMessageKind.Log:
352-
logger.next(message.entry);
352+
const entry = message.entry;
353+
logger.log(entry.level, entry.message, entry);
353354
break;
354355

355356
case JobOutboundMessageKind.ChannelCreate: {

0 commit comments

Comments
 (0)