node-tls-client-kgb
Version:
Advanced library based on node-fetch and tls-client.
34 lines (33 loc) • 1.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.logger = void 0;
const colors = {
reset: "\x1b[0m",
blue: "\x1b[34m",
red: "\x1b[31m",
green: "\x1b[32m",
cyan: "\x1b[36m",
};
/**
* Logger utility.
*
* @property {Function} debug - Logs a debug message.
* @property {Function} error - Logs an error message.
* @property {Function} success - Logs a success message.
* @property {Function} hyperlink - Generates a clickable hyperlink.
*/
exports.logger = {
debug: function (...args) {
return process.stdout.write(`${colors.cyan}@node-tls-client ~ ${colors.blue}DEBUG:${colors.reset} ${args.join(" ")}\n`);
},
error: function (...args) {
return process.stdout.write(`${colors.cyan}@node-tls-client ~ ${colors.red}ERROR:${colors.reset} ${args.join(" ")}\n`);
},
success: function (...args) {
return process.stdout.write(`${colors.cyan}@node-tls-client ~ ${colors.green}SUCCESS:${colors.reset} ${args.join(" ")}\n`);
},
hyperlink: function (text, url) {
return `\x1b]8;;${url}\x1b\\${text}\x1b]8;;\x1b\\`;
},
stamp: `${colors.cyan}@node-tls-client ~${colors.reset}`,
};