Skip to content

Commit

Permalink
chore(logs): clean up http-handler logs a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
awlayton committed Jun 10, 2022
1 parent 8840609 commit 5e4cede
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion oada/services/http-handler/src/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ const plugin: FastifyPluginAsync<Options> = async (fastify, options) => {

// ???: Allow null values in OADA?
if (document === undefined || document === null) {
request.log.error('Resource not found');
reply.notFound();
return;
}
Expand Down
8 changes: 4 additions & 4 deletions oada/services/http-handler/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ await app.register(fastifyGracefulShutdown);
* @todo restrict this to localhost?
*/
await app.register(fastifyHealthcheck, {
exposeUptime: process.env.NODE_ENV === 'development',
exposeUptime: process.env.NODE_ENV !== 'production',
// By default everything is off, so give numbers to under-pressure
underPressureOptions: {
maxEventLoopDelay: 5000,
Expand Down Expand Up @@ -258,7 +258,7 @@ await app.register(async (aApp) => {

return true;
} catch (error: unknown) {
request.log.error({ error });
request.log.error({ error }, 'Token error');
return false;
}
},
Expand Down Expand Up @@ -314,7 +314,7 @@ if (esMain(import.meta)) {
await start();
} catch (error: unknown) {
// eslint-disable-next-line unicorn/consistent-destructuring
app.log.error({ error });
app.log.fatal({ error }, 'Failed to start server');
// eslint-disable-next-line unicorn/no-process-exit
process.exit(1);
}
Expand All @@ -326,7 +326,7 @@ if (esMain(import.meta)) {
async function close(error: Error): Promise<void> {
try {
// eslint-disable-next-line unicorn/consistent-destructuring
app.log.error({ error }, 'Attempting to cleanup server after error.');
app.log.fatal({ error }, 'Attempting to cleanup server after error.');
// Try to close server nicely
await app.close();
} finally {
Expand Down

0 comments on commit 5e4cede

Please sign in to comment.