mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
fix(server) distribute: simplify colors
This commit is contained in:
parent
0ec17645b6
commit
82c576c850
4 changed files with 5 additions and 14 deletions
|
|
@ -17,8 +17,6 @@ const {
|
|||
disconnectedStr,
|
||||
tokenRejectedStr,
|
||||
authTryStr,
|
||||
makeColor,
|
||||
stringToRGB,
|
||||
getMessage,
|
||||
getDescription,
|
||||
logWraped,
|
||||
|
|
@ -36,13 +34,6 @@ const wrapApply = (f, disconnect) => (status) => () => f(null, {
|
|||
const closeIfNot = wraptile((socket, is) => !is && socket.close());
|
||||
const addUrl = currify((url, a) => `${url}: ${a}`);
|
||||
|
||||
const getColorUrl = (url, name) => {
|
||||
if (!name)
|
||||
return url;
|
||||
|
||||
return makeColor(url, stringToRGB(name));
|
||||
};
|
||||
|
||||
const rmListeners = wraptile((socket, listeners) => {
|
||||
socket.removeListener('connect', listeners.onConnect);
|
||||
socket.removeListener('config', listeners.onConfig);
|
||||
|
|
@ -99,7 +90,7 @@ module.exports = (config, options, fn) => {
|
|||
});
|
||||
|
||||
const superFn = wrapApply(fn, socket.close.bind(socket));
|
||||
const colorUrl = getColorUrl(importUrl, name);
|
||||
const colorUrl = importUrl;
|
||||
const close = closeIfNot(socket, importListen);
|
||||
|
||||
const statusStore = fullstore();
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ const chalk = require('chalk');
|
|||
const datetime = require('../../common/datetime');
|
||||
|
||||
const log = (isLog, name, msg) => isLog && console.log(`${datetime()} -> ${name}: ${msg}`);
|
||||
const makeColor = (a, color) => chalk.rgb(color || stringToRGB(a))(a);
|
||||
const makeColor = (a) => chalk.blue(a);
|
||||
const getMessage = (e) => e.message || e;
|
||||
const getDescription = (e) => `${e.type}: ${e.description}`;
|
||||
const getDescription = (e) => e.message;
|
||||
|
||||
module.exports = log;
|
||||
module.exports.logWraped = wraptile(log);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue