Files
Ichsan Kurniawan 5a3629badf update performance, manual attendance, redownload leave form
Added the ability to view and re-download leave application forms in the Employee History page (Leave, Permit, and Sick tabs)
Added employee alpha stats and employee alpha detail in Employee Performance Page
Added total WFO, WFH and WFS in Admin Summary Report
Added batch import from Excel files in Admin Manual Attendance
2026-02-20 15:19:42 +07:00

24 lines
1.1 KiB
TypeScript

// actions/logger.ts
"use server";
import { logger } from "@/lib/logger";
export type LogLevel = 'INFO' | 'WARN' | 'ERROR' | 'DEBUG' | 'API_REQ' | 'API_RES';
// This function receives the log from the browser and writes it to the server file
export async function sendLogToServer(level: LogLevel, message: string, data?: any) {
try {
// Route the log to the correct method in your existing server logger
switch (level) {
case 'INFO': logger.info(`[CLIENT] ${message}`, data); break;
case 'WARN': logger.warn(`[CLIENT] ${message}`, data); break;
case 'ERROR': logger.error(`[CLIENT] ${message}`, data); break;
case 'DEBUG': logger.debug(`[CLIENT] ${message}`, data); break;
case 'API_REQ': logger.apiReq(`[CLIENT] ${message}`, data); break;
case 'API_RES': logger.apiRes(`[CLIENT] ${message}`, data); break;
default: logger.info(`[CLIENT] ${message}`, data); break;
}
} catch (error) {
console.error("Failed to write client log to server:", error);
}
}