mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 05:14:12 +03:00
Updated stop messages to have a consistent interface
- changed method to logStopMessages, as we use start and stop, not start and shutdown - changed logStopMesasges to output the "proper" messages and use this method consistently - the closing connections message isn't really useful - changed uptime message to always be output cos I can't see a case where there isn't interesting/useful
This commit is contained in:
parent
e2adc10a52
commit
31981d086b
@ -124,7 +124,7 @@ GhostServer.prototype.stop = function () {
|
||||
self.httpServer.close(function () {
|
||||
events.emit('server.stop');
|
||||
self.httpServer = null;
|
||||
self.logShutdownMessages();
|
||||
self.logStopMessages();
|
||||
resolve(self);
|
||||
});
|
||||
}
|
||||
@ -145,6 +145,8 @@ GhostServer.prototype.hammertime = function () {
|
||||
* ### Log Start Messages
|
||||
*/
|
||||
GhostServer.prototype.logStartMessages = function () {
|
||||
let self = this;
|
||||
|
||||
// Startup & Shutdown messages
|
||||
if (config.get('env') === 'production') {
|
||||
logging.info(i18n.t('notices.httpServer.ghostIsRunningIn', {env: config.get('env')}));
|
||||
@ -161,17 +163,8 @@ GhostServer.prototype.logStartMessages = function () {
|
||||
}
|
||||
|
||||
function shutdown() {
|
||||
logging.warn(i18n.t('notices.httpServer.ghostHasShutdown'));
|
||||
|
||||
if (config.get('env') === 'production') {
|
||||
logging.warn(i18n.t('notices.httpServer.yourBlogIsNowOffline'));
|
||||
} else {
|
||||
logging.warn(
|
||||
i18n.t('notices.httpServer.ghostWasRunningFor'),
|
||||
moment.duration(process.uptime(), 'seconds').humanize()
|
||||
);
|
||||
}
|
||||
|
||||
// @TODO: await self.stop() here for consistency - but first we need stop to behave correctly
|
||||
self.logStopMessages();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
@ -182,10 +175,21 @@ GhostServer.prototype.logStartMessages = function () {
|
||||
};
|
||||
|
||||
/**
|
||||
* ### Log Shutdown Messages
|
||||
* ### Log Stop Messages
|
||||
*/
|
||||
GhostServer.prototype.logShutdownMessages = function () {
|
||||
logging.warn(i18n.t('notices.httpServer.ghostIsClosingConnections'));
|
||||
GhostServer.prototype.logStopMessages = function () {
|
||||
logging.warn(i18n.t('notices.httpServer.ghostHasShutdown'));
|
||||
|
||||
// Extra clear message for production mode
|
||||
if (config.get('env') === 'production') {
|
||||
logging.warn(i18n.t('notices.httpServer.yourBlogIsNowOffline'));
|
||||
}
|
||||
|
||||
// Always output uptime
|
||||
logging.warn(
|
||||
i18n.t('notices.httpServer.ghostWasRunningFor'),
|
||||
moment.duration(process.uptime(), 'seconds').humanize()
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = GhostServer;
|
||||
|
@ -652,8 +652,7 @@
|
||||
"urlConfiguredAs": "Url configured as: {url}",
|
||||
"ghostHasShutdown": "Ghost has shut down",
|
||||
"yourBlogIsNowOffline": "Your site is now offline",
|
||||
"ghostWasRunningFor": "Ghost was running for",
|
||||
"ghostIsClosingConnections": "Ghost is closing connections"
|
||||
"ghostWasRunningFor": "Ghost was running for"
|
||||
},
|
||||
"mail": {
|
||||
"messageSent": "Message sent. Double check inbox and spam folder!"
|
||||
|
Loading…
Reference in New Issue
Block a user