@defikitdotnet/x-ai-combat
Version:
XCombatAI - Social Media Engagement Template for the Agent Framework
60 lines • 1.63 kB
JavaScript
/**
* X-AI-Combat Logger Utility
*
* Provides logging utilities with consistent formatting
*/
/**
* Log a message with X-AI-COMBAT prefix
*/
export const log = (...args) => {
if (args.length === 0) {
console.log('[X-AI-COMBAT]');
return;
}
const firstArg = args[0];
if (typeof firstArg === 'string') {
// For string first arguments, prefix the string
console.log(`[X-AI-COMBAT] ${firstArg}`, ...args.slice(1));
}
else {
// For non-string first arguments (objects, etc.)
console.log('[X-AI-COMBAT]', ...args);
}
};
/**
* Log an error with X-AI-COMBAT prefix
*/
export const error = (...args) => {
if (args.length === 0) {
console.error('[X-AI-COMBAT]');
return;
}
const firstArg = args[0];
if (typeof firstArg === 'string') {
// For string first arguments, prefix the string
console.log(`[X-AI-COMBAT] ${firstArg}`, ...args.slice(1));
}
else {
// For non-string first arguments (objects, etc.)
console.log('[X-AI-COMBAT]', ...args);
}
};
/**
* Log a warning with X-AI-COMBAT prefix
*/
export const warn = (...args) => {
if (args.length === 0) {
console.warn('[X-AI-COMBAT]');
return;
}
const firstArg = args[0];
if (typeof firstArg === 'string') {
// For string first arguments, prefix the string
console.warn(`[X-AI-COMBAT] ${firstArg}`, ...args.slice(1));
}
else {
// For non-string first arguments (objects, etc.)
console.warn('[X-AI-COMBAT]', ...args);
}
};
//# sourceMappingURL=logger.js.map