From 9ab12118a0387bfc0cdf310410e28db89a2013d3 Mon Sep 17 00:00:00 2001 From: Spacelord Date: Tue, 27 Jun 2023 19:03:38 +0200 Subject: [PATCH] Replaced console.log calls with custom logger ones --- src/routes/api/v1/categories.ts | 4 ++-- src/routes/api/v1/storageLocations.ts | 4 ++-- src/routes/api/v1/storageUnits.ts | 4 ++-- src/routes/frontend/dashboard.ts | 4 ++-- src/routes/frontend/items.ts | 4 ++-- src/routes/frontend/manage/categoryManager.ts | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/routes/api/v1/categories.ts b/src/routes/api/v1/categories.ts index b3454eb..90d5ed5 100644 --- a/src/routes/api/v1/categories.ts +++ b/src/routes/api/v1/categories.ts @@ -23,8 +23,8 @@ function get(req: Request, res: Response) { } }) .catch((err) => { - console.error(err); - res.status(500).render(__path + '/src/frontend/errors/dbError.eta.html', { error: err }); + log.db.error(err); + res.status(500).json({ errorcode: 'DB_ERROR', error: err }); }); } diff --git a/src/routes/api/v1/storageLocations.ts b/src/routes/api/v1/storageLocations.ts index 0299f54..c076cfc 100644 --- a/src/routes/api/v1/storageLocations.ts +++ b/src/routes/api/v1/storageLocations.ts @@ -27,7 +27,7 @@ function get(req: Request, res: Response) { } }) .catch((err) => { - console.error(err); + log.db.error(err); res.status(500).json({ errorcode: 'DB_ERROR', error: err }); }); } else { @@ -46,7 +46,7 @@ function get(req: Request, res: Response) { } }) .catch((err) => { - console.error(err); + log.db.error(err); res.status(500).json({ errorcode: 'DB_ERROR', error: err }); }); } diff --git a/src/routes/api/v1/storageUnits.ts b/src/routes/api/v1/storageUnits.ts index fc0b244..ce9b713 100644 --- a/src/routes/api/v1/storageUnits.ts +++ b/src/routes/api/v1/storageUnits.ts @@ -29,7 +29,7 @@ function get(req: Request, res: Response) { } }) .catch((err) => { - console.error(err); + log.db.error(err); res.status(500).json({ errorcode: 'DB_ERROR', error: err }); }); } else { @@ -49,7 +49,7 @@ function get(req: Request, res: Response) { } }) .catch((err) => { - console.error(err); + log.db.error(err); res.status(500).json({ errorcode: 'DB_ERROR', error: err }); }); } diff --git a/src/routes/frontend/dashboard.ts b/src/routes/frontend/dashboard.ts index f1a24e7..1197190 100644 --- a/src/routes/frontend/dashboard.ts +++ b/src/routes/frontend/dashboard.ts @@ -1,5 +1,5 @@ import express, { Request, Response } from 'express'; -import { prisma, __path } from '../../index.js'; +import { prisma, __path, log } from '../../index.js'; function get(req: Request, res: Response) { prisma.item @@ -17,7 +17,7 @@ function get(req: Request, res: Response) { }); }) .catch((err) => { - console.error(err); + log.db.error(err); res.status(500).render(__path + '/src/frontend/errors/dbError.eta.html', { error: err }); }); } diff --git a/src/routes/frontend/items.ts b/src/routes/frontend/items.ts index 79adb09..c545a6c 100644 --- a/src/routes/frontend/items.ts +++ b/src/routes/frontend/items.ts @@ -1,5 +1,5 @@ import { Request, Response } from 'express'; -import { prisma, __path } from '../../index.js'; +import { prisma, __path, log } from '../../index.js'; async function get(req: Request, res: Response) { // If no page is provided redirect to first @@ -32,7 +32,7 @@ async function get(req: Request, res: Response) { }); }) .catch((err) => { - console.error(err); + log.db.error(err); res.status(500).render(__path + '/src/frontend/errors/dbError.eta.html', { error: err }); }); } diff --git a/src/routes/frontend/manage/categoryManager.ts b/src/routes/frontend/manage/categoryManager.ts index 26fab98..9a53069 100644 --- a/src/routes/frontend/manage/categoryManager.ts +++ b/src/routes/frontend/manage/categoryManager.ts @@ -10,7 +10,7 @@ function get(req: Request, res: Response) { res.render(__path + '/src/frontend/manage/categoryManager.eta.html', { items: items }); }) .catch((err) => { - console.error(err); + log.db.error(err); res.status(500).render(__path + '/src/frontend/errors/dbError.eta.html', { error: err }); }); }