fix(services): Improve logging and enhance MongoDB Compass integration
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import * as plugins from './mod.plugins.js';
|
||||
import * as net from 'net';
|
||||
import { logger } from '../gitzone.logging.js';
|
||||
|
||||
/**
|
||||
* Check if a port is available
|
||||
@@ -58,40 +59,14 @@ export const getProjectName = (): string => {
|
||||
return plugins.path.basename(process.cwd());
|
||||
};
|
||||
|
||||
/**
|
||||
* Print colored message to console
|
||||
*/
|
||||
export const printMessage = (message: string, color?: 'green' | 'yellow' | 'red' | 'blue' | 'magenta' | 'cyan') => {
|
||||
const logger = new plugins.smartlog.ConsoleLog();
|
||||
|
||||
switch (color) {
|
||||
case 'green':
|
||||
logger.log('ok', message);
|
||||
break;
|
||||
case 'yellow':
|
||||
logger.log('note', message);
|
||||
break;
|
||||
case 'red':
|
||||
logger.log('error', message);
|
||||
break;
|
||||
case 'blue':
|
||||
case 'magenta':
|
||||
case 'cyan':
|
||||
logger.log('info', message);
|
||||
break;
|
||||
default:
|
||||
logger.log('info', message);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Print a header with decorative lines
|
||||
*/
|
||||
export const printHeader = (title: string) => {
|
||||
console.log();
|
||||
printMessage('═══════════════════════════════════════════════════════════════', 'cyan');
|
||||
printMessage(` ${title}`, 'cyan');
|
||||
printMessage('═══════════════════════════════════════════════════════════════', 'cyan');
|
||||
logger.log('info', '═══════════════════════════════════════════════════════════════');
|
||||
logger.log('info', ` ${title}`);
|
||||
logger.log('info', '═══════════════════════════════════════════════════════════════');
|
||||
console.log();
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user