first commit
This commit is contained in:
1
dist/utils/.pydio
vendored
Normal file
1
dist/utils/.pydio
vendored
Normal file
@@ -0,0 +1 @@
|
||||
72af0c12-9444-49a6-a65f-b9bd573f5519
|
||||
22
dist/utils/logger.js
vendored
Normal file
22
dist/utils/logger.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const log_symbols_1 = __importDefault(require("log-symbols"));
|
||||
const chalk_1 = __importDefault(require("chalk"));
|
||||
class logger {
|
||||
static logSymbolsSuccess(message) {
|
||||
console.log(chalk_1.default.green.bold(log_symbols_1.default.success, message));
|
||||
}
|
||||
static logSymbolsInfo(message) {
|
||||
console.log(log_symbols_1.default.info, message);
|
||||
}
|
||||
static logSymbolsWarning(message) {
|
||||
console.log(log_symbols_1.default.warning, message);
|
||||
}
|
||||
static logSymbolsError(message) {
|
||||
console.log(chalk_1.default.bold.red(log_symbols_1.default.error, message));
|
||||
}
|
||||
}
|
||||
exports.logger = logger;
|
||||
27
dist/utils/logs.js
vendored
Normal file
27
dist/utils/logs.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const koa_log4_1 = __importDefault(require("koa-log4"));
|
||||
const config_1 = require("../config");
|
||||
koa_log4_1.default.configure(config_1.config.logConfig);
|
||||
class Logs {
|
||||
/**
|
||||
* 访问级别的日志
|
||||
*/
|
||||
static AccessLogger() {
|
||||
return koa_log4_1.default.koaLogger(koa_log4_1.default.getLogger('access'), { level: 'auto' });
|
||||
}
|
||||
/**
|
||||
* 应用级别的日志
|
||||
* @constructor
|
||||
*/
|
||||
static ApplicationLogger() {
|
||||
return koa_log4_1.default.getLogger('application');
|
||||
}
|
||||
static HttpLogger() {
|
||||
return koa_log4_1.default.getLogger('request');
|
||||
}
|
||||
}
|
||||
exports.Logs = Logs;
|
||||
27
dist/utils/utils.js
vendored
Normal file
27
dist/utils/utils.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const index_1 = require("../config/index");
|
||||
class utils {
|
||||
/**
|
||||
* 统一设置网站浏览器的 title 标题内容
|
||||
* @param title
|
||||
*/
|
||||
static titleName(title) {
|
||||
return `${title}${index_1.config.title}`;
|
||||
}
|
||||
/**
|
||||
* 将get地址栏参数转换为对象
|
||||
* @param url
|
||||
*/
|
||||
static parseQueryString(url) {
|
||||
var reg_url = /^[^\?]+\?([\w\W]+)$/, reg_para = /([^&=]+)=([\w\W]*?)(&|$|#)/g, arr_url = reg_url.exec(url), ret = {};
|
||||
if (arr_url && arr_url[1]) {
|
||||
var str_para = arr_url[1], result;
|
||||
while ((result = reg_para.exec(str_para)) != null) {
|
||||
ret[result[1]] = result[2];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
exports.utils = utils;
|
||||
Reference in New Issue
Block a user