mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 20:34:02 +03:00
1fb969ad36
* Installed stripe@7.4.0 refs #38 We were relying on stripe being installed in Ghost, this moves the dep to the correct package. * Created exponentialBackoff wrapper for stripe api refs #38 https://stripe.com/docs/testing#rate-limits The stripe docs suggest to use exponential backoff when recieving a rate limit error. This wrapper will wrap stripe api calls, and retry them after 1s,2s,4s,8s,16s until eventually failing. This gives a total of 5 retries over 31s. * Added wrappers around the stripe api calls refs #38 * Ensured all calls to stripe api go via exp backoff refs #38 * Scaffolding out the error handling for stripe api * Forwarding all errors * Refactored stripe api into modules * Ensured the ready promise object is not replaced * Added logging setup - Sets up common logger structure with custom logger passed through * Ensure logger is kept in module state * Renamed updateLogger to setLogger * Removed `logger` param and exposed setLogger method * Ensured different ids used for test mode * Ensure setLogger works for prototype methods * Removed reconfigureSettings method * Updated payment processer service to keep static ready promise * Added eventemitter to member api instance to handle errors * Moved logging of errors to http level
19 lines
527 B
JavaScript
19 lines
527 B
JavaScript
let currentLogger = {
|
|
error: global.console.error,
|
|
info: global.console.info,
|
|
warn: global.console.warn
|
|
};
|
|
|
|
module.exports = {
|
|
get logging() {
|
|
const loggerInterface = Object.create(currentLogger);
|
|
return Object.assign(loggerInterface, {
|
|
setLogger(newLogger) {
|
|
currentLogger = newLogger;
|
|
// Overwrite any existing reference to loggerInterface
|
|
Object.assign(loggerInterface, Object.create(newLogger));
|
|
}
|
|
});
|
|
}
|
|
};
|