mirror of
https://github.com/tl-open-source/tl-rtc-file.git
synced 2025-09-26 19:41:16 +08:00

feat: 支持单独发送文件 feat: 支持文本私聊 feat: 支持seafile网盘暂存文件 feat: 支持直播房间 feat: 支持取件码下载文件 feat: 支持预览视频文件 feat: 支持报错告警 feat: 调整补充启动logo feat: 调整补充免责协议 feat: 调整补充配置中的版本号 feat: 调整优化开源协议 feat: 调整补充定制收费服务 feat: 调整优化服务端代码 feat: 调整优化批量发送逻辑 feat: 调整优化样式体验 feat: 调整优化conf中ws, manage相关配置 feat: 调整优化文件发送时间间隔为1秒钟 feat: 调整优化文件发送体验 feat: 调整优化选择文件逻辑 feat: 调整优化启动文件/命令 feat: 调整优化socket配置区分 feat: 调整优化分享进入房间 feat: 调整优化右上角消息提示 feat: 调整删除npm依赖 feat: 调整删除首次弹窗 feat: 即将支持远程cavas画笔 feat: 即将支持远程控制
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
const colors = require('ansi-colors');
|
|
const fancyLog = require('fancy-log');
|
|
const argv = require('yargs').argv;
|
|
const supportsColor = require('color-support');
|
|
|
|
class Log {
|
|
constructor() {
|
|
this.colors = colors;
|
|
}
|
|
|
|
addColor(str, type) {
|
|
if (supportsColor() && (typeof argv.color === 'undefined' || argv.color)) {
|
|
if (type === 'warn') {
|
|
return this.colors.yellow(str);
|
|
} else if (type === 'error') {
|
|
return this.colors.red(str);
|
|
} else if (type === 'info') {
|
|
return this.colors.gray(str);
|
|
}
|
|
return this.colors.green(str);
|
|
}
|
|
return str;
|
|
}
|
|
|
|
log(content, tag = '1.0.0') {
|
|
fancyLog(this.addColor(`[TL-RTC-FILE] ${tag}: `, 'log') + content);
|
|
}
|
|
|
|
warn(content, tag = '1.0.0') {
|
|
fancyLog(this.addColor(`[TL-RTC-FILE] ${tag}: `, 'warn') + content);
|
|
}
|
|
|
|
error(content, tag = '1.0.0') {
|
|
fancyLog(this.addColor(`[TL-RTC-FILE] ${tag}: `, 'error') + content);
|
|
}
|
|
}
|
|
|
|
module.exports = new Log(); |