refactor: replace console.log with structured logger calls
Replace raw `console.log`/`console.error` calls across CLI, API handlers, and module files with structured logger functions (`step`, `done`, `warn`, `fail`) from the shared logger library. This improves log consistency, readability, and makes it easier to control output formatting and log levels from a single place.
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
'use server';
|
||||
|
||||
import { query } from '@zen/core/database';
|
||||
import { fail } from '../../../shared/lib/logger.js';
|
||||
|
||||
/**
|
||||
* Get total number of users
|
||||
@@ -50,7 +51,7 @@ async function getTotalUsersCount() {
|
||||
);
|
||||
return parseInt(result.rows[0].count) || 0;
|
||||
} catch (error) {
|
||||
console.error('Error getting users count:', error);
|
||||
fail(`Error getting users count: ${error.message}`);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -70,7 +71,7 @@ export async function getDashboardStats() {
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Error getting dashboard stats:', error);
|
||||
fail(`Error getting dashboard stats: ${error.message}`);
|
||||
return {
|
||||
success: false,
|
||||
error: error.message || 'Failed to get dashboard statistics'
|
||||
|
||||
Reference in New Issue
Block a user