summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2021-03-10 14:58:23 +0300
committerEvgeny Zinoviev <me@ch1p.io>2021-03-10 14:58:23 +0300
commit897d169b6e1943e54463480309fd6f2057383c5d (patch)
tree9eca6a453b79b54ab3f66abb8afd304ae5b1a6aa
parent97ce1da61986ba76b6ec8858c36e46b714873e55 (diff)
async logger.shutdown
-rwxr-xr-xsrc/jobctl.js7
-rwxr-xr-xsrc/jobd-master.js7
-rwxr-xr-xsrc/jobd.js9
-rw-r--r--src/lib/logger.js5
4 files changed, 14 insertions, 14 deletions
diff --git a/src/jobctl.js b/src/jobctl.js
index ca96b24..887a073 100755
--- a/src/jobctl.js
+++ b/src/jobctl.js
@@ -346,13 +346,12 @@ Configuration file
process.exit(exitCode)
}
-function term() {
+async function term() {
if (logger)
logger.info('shutdown')
- loggerModule.shutdown(function() {
- process.exit()
- })
+ await loggerModule.shutdown()
+ process.exit()
}
async function exists(file) {
diff --git a/src/jobd-master.js b/src/jobd-master.js
index c926dc0..9827126 100755
--- a/src/jobd-master.js
+++ b/src/jobd-master.js
@@ -306,11 +306,10 @@ Options:
console.log(s)
}
-function term() {
+async function term() {
if (logger)
logger.info('shutdown')
- loggerModule.shutdown(function() {
- process.exit()
- })
+ await loggerModule.shutdown()
+ process.exit()
}
diff --git a/src/jobd.js b/src/jobd.js
index 0d8af32..e1331d1 100755
--- a/src/jobd.js
+++ b/src/jobd.js
@@ -448,11 +448,10 @@ Options:
console.log(s)
}
-function term() {
+async function term() {
if (logger)
logger.info('shutdown')
- loggerModule.shutdown(function() {
- process.exit()
- })
-} \ No newline at end of file
+ await loggerModule.shutdown()
+ process.exit()
+}
diff --git a/src/lib/logger.js b/src/lib/logger.js
index 8a44e07..f886e0c 100644
--- a/src/lib/logger.js
+++ b/src/lib/logger.js
@@ -102,9 +102,12 @@ module.exports = {
/**
* @param cb
+ * @return {Promise}
*/
shutdown(cb) {
- log4js.shutdown(cb)
+ return new Promise((resolve, reject) => {
+ log4js.shutdown(resolve)
+ })
},
Logger: log4js.Logger,