integrated the new logger across the entire API
This commit is contained in:
@@ -4,6 +4,7 @@ const memberStatusR = express.Router();
|
||||
|
||||
import pool from '../db';
|
||||
import { requireLogin } from '../middleware/auth';
|
||||
import { logger } from '../services/logging/logger';
|
||||
|
||||
statusR.use(requireLogin);
|
||||
memberStatusR.use(requireLogin);
|
||||
@@ -38,9 +39,16 @@ statusR.get('/', async (req, res) => {
|
||||
try {
|
||||
const result = await pool.query('SELECT * FROM statuses;');
|
||||
res.json(result);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.status(500).json({ error: 'Internal server error' });
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
'app',
|
||||
'Failed to get all statuses',
|
||||
{
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
stack: error instanceof Error ? error.stack : undefined,
|
||||
}
|
||||
);
|
||||
res.sendStatus(500);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user