Skip to content

Commit

Permalink
perf(logger): gets the pid at logger creation instead of at log time
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcdo29 committed Apr 19, 2020
1 parent 60dbc2c commit d8913d0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/logger/src/logger/ogma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface JSONLog {

export class Ogma {
private options: OgmaOptions;
private pid: number;

public fine = this.verbose;
public log = this.info;
Expand Down Expand Up @@ -46,6 +47,7 @@ export class Ogma {
`Ogma logLevel was set to ${options.logLevel} which does not match a defined logLevel. Falling back to default instead.`,
);
}
this.pid = process.pid;
}

private printMessage(
Expand Down Expand Up @@ -114,7 +116,7 @@ export class Ogma {
if (application || this.options.application) {
json.application = application || this.options.application;
}
json.pid = process.pid;
json.pid = this.pid;
if (context || this.options.context) {
json.context = context || this.options.context;
}
Expand Down Expand Up @@ -150,7 +152,7 @@ export class Ogma {
),
);
}
arrayString.push(process.pid);
arrayString.push(this.pid);
if (context || this.options.context) {
arrayString.push(
colorize(
Expand Down

0 comments on commit d8913d0

Please sign in to comment.