aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/helpers/logger.ts8
-rw-r--r--server/middlewares/cache.ts4
2 files changed, 10 insertions, 2 deletions
diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts
index ce6e38f15..e1e3a1fe2 100644
--- a/server/helpers/logger.ts
+++ b/server/helpers/logger.ts
@@ -22,7 +22,13 @@ function loggerReplacer (key: string, value: any) {
22} 22}
23 23
24const consoleLoggerFormat = winston.format.printf(info => { 24const consoleLoggerFormat = winston.format.printf(info => {
25 let additionalInfos = JSON.stringify(info.meta || info.err, loggerReplacer, 2) 25 const obj = {
26 meta: info.meta,
27 err: info.err,
28 sql: info.sql
29 }
30
31 let additionalInfos = JSON.stringify(obj, loggerReplacer, 2)
26 if (additionalInfos === undefined || additionalInfos === '{}') additionalInfos = '' 32 if (additionalInfos === undefined || additionalInfos === '{}') additionalInfos = ''
27 else additionalInfos = ' ' + additionalInfos 33 else additionalInfos = ' ' + additionalInfos
28 34
diff --git a/server/middlewares/cache.ts b/server/middlewares/cache.ts
index b40486e4b..1b44957d3 100644
--- a/server/middlewares/cache.ts
+++ b/server/middlewares/cache.ts
@@ -31,6 +31,8 @@ function cacheRoute (lifetimeArg: string | number) {
31 logger.error('Cannot cache route.', { err }) 31 logger.error('Cannot cache route.', { err })
32 return done(err) 32 return done(err)
33 }) 33 })
34 } else {
35 done()
34 } 36 }
35 37
36 return sendSave(body) 38 return sendSave(body)
@@ -52,7 +54,7 @@ function cacheRoute (lifetimeArg: string | number) {
52 return done() 54 return done()
53 }) 55 })
54 } catch (err) { 56 } catch (err) {
55 logger.error('Cannot serve cached route.', err) 57 logger.error('Cannot serve cached route.', { err })
56 return next() 58 return next()
57 } 59 }
58 } 60 }