fix(logger): gateway log cache issue && upgrade winston (#4250)

* fix(logger): gateway log cache

* chore(logger): bump winston to 3.13.0
This commit is contained in:
YANG QIA 2024-04-30 21:08:15 +08:00 committed by GitHub
parent 6fbe77d10c
commit 5313b8e495
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 27 additions and 26 deletions

View File

@ -408,7 +408,7 @@ export class ACL extends EventEmitter {
const permission = ctx.permission;
ctx.log?.info && ctx.log.info('ctx permission', permission);
ctx.log?.debug && ctx.log.debug('ctx permission', permission);
if ((!permission.can || typeof permission.can !== 'object') && !permission.skip) {
ctx.throw(403, 'No permissions');
@ -417,14 +417,14 @@ export class ACL extends EventEmitter {
const params = permission.can?.params || acl.fixedParamsManager.getParams(resourceName, actionName);
ctx.log?.info && ctx.log.info('acl params', params);
ctx.log?.debug && ctx.log.debug('acl params', params);
if (params && resourcerAction.mergeParams) {
const filteredParams = acl.filterParams(ctx, resourceName, params);
const parsedParams = await acl.parseJsonTemplate(filteredParams, ctx);
ctx.permission.parsedParams = parsedParams;
ctx.log?.info && ctx.log.info('acl parsedParams', parsedParams);
ctx.log?.debug && ctx.log.debug('acl parsedParams', parsedParams);
ctx.permission.rawParams = lodash.cloneDeep(resourcerAction.params);
resourcerAction.mergeParams(parsedParams, {
appends: (x, y) => {

View File

@ -14,9 +14,9 @@
"chalk": "^4",
"lodash": "^4.17.21",
"triple-beam": "^1.4.1",
"winston": "^3.8.2",
"winston-daily-rotate-file": "^4.7.1",
"winston-transport": "^4.5.0"
"winston": "^3.13.0",
"winston-daily-rotate-file": "^5.0.0",
"winston-transport": "^4.7.0"
},
"gitHead": "d0b4efe4be55f8c79a98a331d99d9f8cf99021a1"
}

View File

@ -159,6 +159,7 @@ export class Gateway extends EventEmitter {
module: 'gateway',
},
});
this.loggers.register(appName, logger);
return logger.child({ reqId });
}

View File

@ -19355,10 +19355,10 @@ object-copy@^0.1.0:
define-property "^0.2.5"
kind-of "^3.0.3"
object-hash@^2.0.1:
version "2.2.0"
resolved "https://registry.npmmirror.com/object-hash/-/object-hash-2.2.0.tgz#5ad518581eefc443bd763472b8ff2e9c2c0d54a5"
integrity sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==
object-hash@^3.0.0:
version "3.0.0"
resolved "https://registry.npmmirror.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9"
integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==
object-inspect@^1.13.1, object-inspect@^1.9.0:
version "1.13.1"
@ -26376,29 +26376,29 @@ window-size@0.1.0:
resolved "https://registry.npmmirror.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
integrity sha512-1pTPQDKTdd61ozlKGNCjhNRd+KPmgLSGa3mZTHoOliaGcESD8G1PXhh7c1fgiPjVbNVfgy2Faw4BI8/m0cC8Mg==
winston-daily-rotate-file@^4.7.1:
version "4.7.1"
resolved "https://registry.npmmirror.com/winston-daily-rotate-file/-/winston-daily-rotate-file-4.7.1.tgz#f60a643af87f8867f23170d8cd87dbe3603a625f"
integrity sha512-7LGPiYGBPNyGHLn9z33i96zx/bd71pjBn9tqQzO3I4Tayv94WPmBNwKC7CO1wPHdP9uvu+Md/1nr6VSH9h0iaA==
winston-daily-rotate-file@^5.0.0:
version "5.0.0"
resolved "https://registry.npmmirror.com/winston-daily-rotate-file/-/winston-daily-rotate-file-5.0.0.tgz#8cd94800025490e47c00ec892b655a5821f4266d"
integrity sha512-JDjiXXkM5qvwY06733vf09I2wnMXpZEhxEVOSPenZMii+g7pcDcTBt2MRugnoi8BwVSuCT2jfRXBUy+n1Zz/Yw==
dependencies:
file-stream-rotator "^0.6.1"
object-hash "^2.0.1"
triple-beam "^1.3.0"
winston-transport "^4.4.0"
object-hash "^3.0.0"
triple-beam "^1.4.1"
winston-transport "^4.7.0"
winston-transport@^4.4.0, winston-transport@^4.5.0:
version "4.6.0"
resolved "https://registry.npmmirror.com/winston-transport/-/winston-transport-4.6.0.tgz#f1c1a665ad1b366df72199e27892721832a19e1b"
integrity sha512-wbBA9PbPAHxKiygo7ub7BYRiKxms0tpfU2ljtWzb3SjRjv5yl6Ozuy/TkXf00HTAt+Uylo3gSkNwzc4ME0wiIg==
winston-transport@^4.7.0:
version "4.7.0"
resolved "https://registry.npmmirror.com/winston-transport/-/winston-transport-4.7.0.tgz#e302e6889e6ccb7f383b926df6936a5b781bd1f0"
integrity sha512-ajBj65K5I7denzer2IYW6+2bNIVqLGDHqDw3Ow8Ohh+vdW+rv4MZ6eiDvHoKhfJFZ2auyN8byXieDDJ96ViONg==
dependencies:
logform "^2.3.2"
readable-stream "^3.6.0"
triple-beam "^1.3.0"
winston@^3.8.2:
version "3.11.0"
resolved "https://registry.npmmirror.com/winston/-/winston-3.11.0.tgz#2d50b0a695a2758bb1c95279f0a88e858163ed91"
integrity sha512-L3yR6/MzZAOl0DsysUXHVjOwv8mKZ71TrA/41EIduGpOOV5LQVodqN+QdQ6BS6PJ/RdIshZhq84P/fStEZkk7g==
winston@^3.13.0:
version "3.13.0"
resolved "https://registry.npmmirror.com/winston/-/winston-3.13.0.tgz#e76c0d722f78e04838158c61adc1287201de7ce3"
integrity sha512-rwidmA1w3SE4j0E5MuIufFhyJPBDG7Nu71RkZor1p2+qHvJSZ9GYDA81AyleQcZbh/+V6HjeBdfnTZJm9rSeQQ==
dependencies:
"@colors/colors" "^1.6.0"
"@dabh/diagnostics" "^2.0.2"
@ -26410,7 +26410,7 @@ winston@^3.8.2:
safe-stable-stringify "^2.3.1"
stack-trace "0.0.x"
triple-beam "^1.3.0"
winston-transport "^4.5.0"
winston-transport "^4.7.0"
wkx@^0.5.0:
version "0.5.0"