日志:短链接记录
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user