Use logger

This commit is contained in:
Owen Schwartz
2024-09-28 23:55:09 -04:00
parent cfeb0930bc
commit 8a009f7fbc
2 changed files with 3 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ import { Request, Response, NextFunction } from 'express';
import { DrizzleError, eq } from 'drizzle-orm';
import { sites, resources, targets, exitNodes } from '@server/db/schema';
import db from '@server/db';
import logger from '@server/logger';
export const getConfig = async (req: Request, res: Response, next: NextFunction): Promise<void> => {
try {
@@ -53,7 +54,7 @@ export const getConfig = async (req: Request, res: Response, next: NextFunction)
res.json(config);
} catch (error) {
console.error('Error querying database:', error);
logger.error('Error querying database:', error);
if (error instanceof DrizzleError) {
res.status(500).json({ error: 'Database query error', message: error.message });
} else {

View File

@@ -27,7 +27,7 @@ export const receiveBandwidth = async (req: Request, res: Response, next: NextFu
});
if (!site) {
console.warn(`Site not found for public key: ${publicKey}`);
logger.warn(`Site not found for public key: ${publicKey}`);
continue;
}