Skip to content

Commit

Permalink
feat: add offset property
Browse files Browse the repository at this point in the history
  • Loading branch information
XVincentX committed Jul 1, 2019
1 parent fea8574 commit 1438bfd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/cli/src/util/createServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ async function createPrismServerWithLogger(options: CreatePrismOptions, logInsta
function pipeOutputToSignale(stream: Readable) {
function constructPrefix(logLine: LogDescriptor): string {
const logOptions = LOG_COLOR_MAP[logLine.name];
const prefix = ' '.repeat(logOptions.index).concat(logOptions.color.black(`[${logLine.name}]`));
const prefix = ' '
.repeat(logOptions.index + (logLine.offset || 0))
.concat(logOptions.color.black(`[${logLine.name}]`));

return logLine.input
? prefix.concat(' ' + chalk.bold.white(`${logLine.input.method} ${logLine.input.url.path}`))
Expand Down
2 changes: 1 addition & 1 deletion packages/http-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const replyHandler = <LoaderInput>(
reply.res.end();
}

request.log.error({ input }, `Request terminated with error: ${e}`);
request.log.error({ input, offset: 1 }, `Request terminated with error: ${e}`);
}
};
};

0 comments on commit 1438bfd

Please sign in to comment.