日志:短链接记录

This commit is contained in:
luying
2021-07-27 16:56:57 +08:00
parent ff36c4b361
commit 7bc4ff4577
20 changed files with 244 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg';
const path = require('path');
export default (appInfo: EggAppInfo) => {
const config = {} as PowerPartial<EggAppConfig>;
@@ -8,7 +9,7 @@ export default (appInfo: EggAppInfo) => {
config.keys = appInfo.name + '_1600244957952_7142';
// add your egg config in here
config.middleware = [];
config.middleware = ['log'];
config.cluster = {
listen: {
@@ -47,6 +48,22 @@ export default (appInfo: EggAppInfo) => {
packages: [ '/root/zyz/web-server/package.json' ],
};
config.customLogger = {
linkLogger: {
file: path.join(appInfo.root, 'logs/gm-server/link-log.log'),
formatter(meta) {
return `[${meta.level}] [${meta.date}] ${meta.message}`;
},
},
};
config.logrotator = {
filesRotateBySize: [
path.join(appInfo.root, 'logs/link-log.log'),
],
maxFileSize: 1024,
};
// the return config will combines to EggAppConfig
return {
...config,