UNPKG

@dexwox-labs/a2a-server

Version:

TypeScript server implementation for Google's Agent-to-Agent (A2A) protocol - includes Express/WebSocket handlers, request validation and queue management

50 lines 1.98 kB
"use strict"; /** * @module Logger * @description Centralized logging utility for the A2A protocol server * * This module provides a centralized logger instance for the A2A protocol server, * configured with appropriate log levels and formatting based on the environment. * It uses Winston as the underlying logging library. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const winston_1 = __importDefault(require("winston")); /** * Centralized logger instance for the A2A protocol server * * This logger is configured to output to the console with appropriate formatting * and log levels based on the environment. In production, it logs at the 'info' * level and above, while in development it logs at the 'debug' level and above. * * @example * ```typescript * import logger from './utils/logger'; * * // Log at different levels * logger.debug('Detailed debugging information'); * logger.info('Something noteworthy happened'); * logger.warn('Something concerning happened'); * logger.error('Something went wrong', { error: new Error('Details') }); * ``` */ const logger = winston_1.default.createLogger({ // Use 'info' level in production, 'debug' in development level: process.env.NODE_ENV === 'production' ? 'info' : 'debug', // Configure log formatting format: winston_1.default.format.combine(winston_1.default.format.timestamp(), winston_1.default.format.json(), winston_1.default.format.colorize(), winston_1.default.format.simple()), // Output to console transports: [ new winston_1.default.transports.Console() ] }); /** * Export the logger instance as the default export * * This allows the logger to be imported and used throughout the application * with a simple import statement. */ exports.default = logger; //# sourceMappingURL=logger.js.map