0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

chore: better logging for publish (#2163)

This commit is contained in:
Juan Picado 2021-04-03 22:09:31 +02:00 committed by GitHub
parent 045d65e0ba
commit 6fef45f9ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -203,7 +203,7 @@ class Auth implements IAuth {
} else {
plugin.allow_unpublish!(user, pkg, (err, ok: boolean): void => {
if (err) {
this.logger.error({ packageName }, 'forbidden publish for @{packageName}, it will fallback on unpublish permissions');
this.logger.error({ packageName, user: user?.name }, '@{user} forbidden publish for @{packageName}, it will fallback on unpublish permissions');
return callback(err);
}
@ -215,7 +215,7 @@ class Auth implements IAuth {
}
if (ok) {
this.logger.info({ packageName }, 'allowed unpublish for @{packageName}');
this.logger.info({ packageName, user: user?.name }, '@{user} allowed unpublish for @{packageName}');
return callback(null, ok);
}
});
@ -242,12 +242,12 @@ class Auth implements IAuth {
// @ts-ignore
plugin.allow_publish(user, pkg, (err: VerdaccioError, ok: boolean): void => {
if (_.isNil(err) === false && _.isError(err)) {
self.logger.error({ packageName }, 'forbidden publish for @{packageName}');
self.logger.error({ packageName, user: user?.name }, '@{user} is forbidden publish for @{packageName}');
return callback(err);
}
if (ok) {
self.logger.info({ packageName }, 'allowed publish for @{packageName}');
self.logger.info({ packageName, user: user?.name }, '@{user} is allowed publish for @{packageName}');
return callback(null, ok);
}
debug('allow publish skip validation for %o', packageName);