import winston from 'winston';
export const logger = winston.createLogger({
level: process.env.LOG_LEVEL || 'info',
format: winston.format.combine(
winston.format.timestamp(),
winston.format.errors({ stack: true }),
winston.format.json()
),
transports: [
new winston.transports.Console({
format: winston.format.combine(
winston.format.colorize(),
winston.format.simple()
)
})
]
});
export function logToolInvocation(toolName: string, args: any) {
logger.info('Tool invoked', { tool: toolName, args });
}
export function logApiCall(method: string, url: string, requestId?: string) {
logger.debug('API call', { method, url, requestId });
}
export function logApiError(error: any, context?: any) {
logger.error('API error', { error: error.message, context });
}
export function logDeploymentAction(action: string, appId: string, deploymentId?: string) {
logger.info('Deployment action', { action, appId, deploymentId });
}