Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
hokaccha committed Jul 5, 2024
1 parent 0030b91 commit bf1f047
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,11 @@ export class StructuredLogger implements LoggerService {
}

// error(message: string, error: Error, ...params)
if (args.length > 1 && typeof args[0] === "string" && args[1] instanceof Error) {
if (
args.length > 1 &&
typeof args[0] === "string" &&
args[1] instanceof Error
) {
const message = args[0];
const err = args[1];
const params = args.slice(2);
Expand All @@ -318,15 +322,15 @@ export class StructuredLogger implements LoggerService {
message,
stack: err.stack,
context: last,
params: params.slice(0, -1).concat([{ error: err.toString() }])
}
params: params.slice(0, -1).concat([{ error: err.toString() }]),
};
} else {
return {
message,
stack: err.stack,
context: null,
params: params.concat([{ error: err.toString() }])
}
params: params.concat([{ error: err.toString() }]),
};
}
}

Expand Down

0 comments on commit bf1f047

Please sign in to comment.