dbx-mcp-server
Version:
A Model Context Protocol server for Dropbox integration with AI-powered PDF analysis, multi-directory indexing, and parallel processing
53 lines • 1.97 kB
JavaScript
/**
* Custom logger utility for tests that suppresses stack traces
* while preserving the actual log messages.
*/
// Store original console methods
const originalConsole = {
log: console.log,
error: console.error,
warn: console.warn,
info: console.info,
debug: console.debug
};
// Create wrapper functions that use a direct approach to avoid stack traces
export const logger = {
log: (...args) => {
process.stdout.write(args.map(arg => typeof arg === 'object' ? JSON.stringify(arg, null, 2) : String(arg)).join(' ') + '\n');
},
error: (...args) => {
process.stderr.write('ERROR: ' + args.map(arg => typeof arg === 'object' ? JSON.stringify(arg, null, 2) : String(arg)).join(' ') + '\n');
},
warn: (...args) => {
process.stdout.write('WARNING: ' + args.map(arg => typeof arg === 'object' ? JSON.stringify(arg, null, 2) : String(arg)).join(' ') + '\n');
},
info: (...args) => {
process.stdout.write('INFO: ' + args.map(arg => typeof arg === 'object' ? JSON.stringify(arg, null, 2) : String(arg)).join(' ') + '\n');
},
debug: (...args) => {
process.stdout.write('DEBUG: ' + args.map(arg => typeof arg === 'object' ? JSON.stringify(arg, null, 2) : String(arg)).join(' ') + '\n');
}
};
/**
* Replaces the global console methods with our custom logger
* Call this at the beginning of your test file
*/
export function setupTestLogger() {
console.log = logger.log;
console.error = logger.error;
console.warn = logger.warn;
console.info = logger.info;
console.debug = logger.debug;
}
/**
* Restores the original console methods
* Call this in afterAll to clean up
*/
export function restoreConsole() {
console.log = originalConsole.log;
console.error = originalConsole.error;
console.warn = originalConsole.warn;
console.info = originalConsole.info;
console.debug = originalConsole.debug;
}
//# sourceMappingURL=test-logger.js.map