Fix logging and robots.txt

This commit is contained in:
gpt-engineer-app[bot]
2025-11-04 22:01:27 +00:00
parent 40ebc3c11b
commit ffd71f51fb
3 changed files with 71 additions and 14 deletions

33
api/utils/logger.ts Normal file
View File

@@ -0,0 +1,33 @@
/**
* Vercel Serverless Function Logger
* Provides structured JSON logging for Vercel API routes
* Matches the edge function logging pattern for consistency
*/
type LogLevel = 'info' | 'warn' | 'error';
interface LogContext {
[key: string]: unknown;
}
function formatLog(level: LogLevel, message: string, context?: LogContext): string {
return JSON.stringify({
timestamp: new Date().toISOString(),
level,
message,
service: 'vercel-ssrog',
...context
});
}
export const vercelLogger = {
info: (message: string, context?: LogContext) => {
console.info(formatLog('info', message, context));
},
warn: (message: string, context?: LogContext) => {
console.warn(formatLog('warn', message, context));
},
error: (message: string, context?: LogContext) => {
console.error(formatLog('error', message, context));
}
};