mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-24 21:15:51 +01:00
chore: better logging for publish (#2163)
This commit is contained in:
parent
045d65e0ba
commit
6fef45f9ef
@ -203,7 +203,7 @@ class Auth implements IAuth {
|
|||||||
} else {
|
} else {
|
||||||
plugin.allow_unpublish!(user, pkg, (err, ok: boolean): void => {
|
plugin.allow_unpublish!(user, pkg, (err, ok: boolean): void => {
|
||||||
if (err) {
|
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);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ class Auth implements IAuth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ok) {
|
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);
|
return callback(null, ok);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -242,12 +242,12 @@ class Auth implements IAuth {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
plugin.allow_publish(user, pkg, (err: VerdaccioError, ok: boolean): void => {
|
plugin.allow_publish(user, pkg, (err: VerdaccioError, ok: boolean): void => {
|
||||||
if (_.isNil(err) === false && _.isError(err)) {
|
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);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ok) {
|
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);
|
return callback(null, ok);
|
||||||
}
|
}
|
||||||
debug('allow publish skip validation for %o', packageName);
|
debug('allow publish skip validation for %o', packageName);
|
||||||
|
Loading…
Reference in New Issue
Block a user