From 7a2f766668bd9f6e04408f5e9042f7d2815de9f3 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Wed, 31 Aug 2022 10:01:34 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Added=20logging=20configuration=20o?= =?UTF-8?q?ption=20for=20timestamps=20to=20use=20the=20local=20timezone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes https://github.com/TryGhost/Ghost/issues/15190 refs https://github.com/TryGhost/framework/pull/76 - log output always uses UTC timestamps, but it may be desirable to configure logs to use the local machine timezone - a new config option has been added to `@tryghost/logging` so you can switch the logs to the local timezone - this commit bumps the package and sets the default config option to `false`, so it doesn't suddenly change the timezone of the logs - docs will be updated soon but if you'd like to use the timezone-altered timestamps, you can set `logging.useLocalTime` to `true` - credits to https://github.com/levee223 for the implementation and PR --- ghost/bootstrap-socket/package.json | 2 +- ghost/core/core/shared/config/defaults.json | 1 + ghost/core/package.json | 4 ++-- ghost/job-manager/package.json | 2 +- ghost/mailgun-client/package.json | 2 +- ghost/members-api/package.json | 6 +++--- ghost/oembed-service/package.json | 2 +- ghost/stripe/package.json | 2 +- ghost/update-check-service/package.json | 2 +- package.json | 2 +- yarn.lock | 8 ++++---- 11 files changed, 17 insertions(+), 16 deletions(-) diff --git a/ghost/bootstrap-socket/package.json b/ghost/bootstrap-socket/package.json index 76798eced9..34fb30c1d9 100644 --- a/ghost/bootstrap-socket/package.json +++ b/ghost/bootstrap-socket/package.json @@ -22,6 +22,6 @@ "sinon": "14.0.0" }, "dependencies": { - "@tryghost/logging": "2.2.4" + "@tryghost/logging": "2.3.0" } } diff --git a/ghost/core/core/shared/config/defaults.json b/ghost/core/core/shared/config/defaults.json index 899b88f248..e2ea525d2c 100644 --- a/ghost/core/core/shared/config/defaults.json +++ b/ghost/core/core/shared/config/defaults.json @@ -52,6 +52,7 @@ }, "logging": { "level": "info", + "useLocalTime": false, "rotation": { "enabled": false, "period": "1d", diff --git a/ghost/core/package.json b/ghost/core/package.json index 121750b80b..8010f3659e 100644 --- a/ghost/core/package.json +++ b/ghost/core/package.json @@ -80,7 +80,7 @@ "@tryghost/kg-default-cards": "5.16.3", "@tryghost/kg-mobiledoc-html-renderer": "5.3.6", "@tryghost/limit-service": "1.2.3", - "@tryghost/logging": "2.2.4", + "@tryghost/logging": "2.3.0", "@tryghost/magic-link": "0.0.0", "@tryghost/mailgun-client": "0.0.0", "@tryghost/member-attribution": "0.0.0", @@ -209,7 +209,7 @@ "tmp": "0.2.1" }, "resolutions": { - "@tryghost/logging": "2.2.4", + "@tryghost/logging": "2.3.0", "moment": "2.24.0", "moment-timezone": "0.5.23" } diff --git a/ghost/job-manager/package.json b/ghost/job-manager/package.json index 65bf127147..f1c6e32f41 100644 --- a/ghost/job-manager/package.json +++ b/ghost/job-manager/package.json @@ -27,7 +27,7 @@ "dependencies": { "@breejs/later": "4.1.0", "@tryghost/errors": "1.2.15", - "@tryghost/logging": "2.2.4", + "@tryghost/logging": "2.3.0", "bree": "6.5.0", "cron-validate": "1.4.3", "fastq": "1.13.0", diff --git a/ghost/mailgun-client/package.json b/ghost/mailgun-client/package.json index 0ec3c6f29a..f806747045 100644 --- a/ghost/mailgun-client/package.json +++ b/ghost/mailgun-client/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@tryghost/debug": "0.1.18", - "@tryghost/logging": "2.2.4", + "@tryghost/logging": "2.3.0", "form-data": "4.0.0", "lodash": "4.17.21", "mailgun.js": "8.0.1" diff --git a/ghost/members-api/package.json b/ghost/members-api/package.json index 3b151dc2ac..a59e7141f5 100644 --- a/ghost/members-api/package.json +++ b/ghost/members-api/package.json @@ -18,19 +18,19 @@ "gateway" ], "devDependencies": { + "@tryghost/member-attribution": "0.0.0", "@types/node-jose": "1.1.10", "c8": "7.12.0", "jwk-to-pem": "2.0.5", "mocha": "10.0.0", "nock": "13.2.9", "should": "13.2.3", - "sinon": "14.0.0", - "@tryghost/member-attribution": "0.0.0" + "sinon": "14.0.0" }, "dependencies": { "@tryghost/domain-events": "0.0.0", "@tryghost/errors": "1.2.15", - "@tryghost/logging": "2.2.4", + "@tryghost/logging": "2.3.0", "@tryghost/magic-link": "0.0.0", "@tryghost/member-analytics-service": "0.0.0", "@tryghost/member-events": "0.0.0", diff --git a/ghost/oembed-service/package.json b/ghost/oembed-service/package.json index 1de13156b1..5e90e98e5f 100644 --- a/ghost/oembed-service/package.json +++ b/ghost/oembed-service/package.json @@ -23,7 +23,7 @@ }, "dependencies": { "@tryghost/errors": "1.2.15", - "@tryghost/logging": "2.2.4", + "@tryghost/logging": "2.3.0", "@tryghost/tpl": "0.1.18", "cheerio": "0.22.0", "lodash": "4.17.21", diff --git a/ghost/stripe/package.json b/ghost/stripe/package.json index 2c90105c9a..986313ced6 100644 --- a/ghost/stripe/package.json +++ b/ghost/stripe/package.json @@ -26,7 +26,7 @@ "@tryghost/debug": "0.1.18", "@tryghost/domain-events": "0.0.0", "@tryghost/errors": "1.2.15", - "@tryghost/logging": "2.2.4", + "@tryghost/logging": "2.3.0", "@tryghost/member-events": "0.0.0", "leaky-bucket": "2.2.0", "lodash": "4.17.21", diff --git a/ghost/update-check-service/package.json b/ghost/update-check-service/package.json index 3fe649cbb8..93278f72d0 100644 --- a/ghost/update-check-service/package.json +++ b/ghost/update-check-service/package.json @@ -25,7 +25,7 @@ "dependencies": { "@tryghost/debug": "0.1.18", "@tryghost/errors": "1.2.15", - "@tryghost/logging": "2.2.4", + "@tryghost/logging": "2.3.0", "@tryghost/tpl": "0.1.18", "bluebird": "3.7.2", "lodash": "4.17.21", diff --git a/package.json b/package.json index feb5b20382..d02401c192 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "main:submodules": "git submodule sync && git submodule update && git submodule foreach \"git checkout main && git pull ${GHOST_UPSTREAM:-origin} main && yarn\"" }, "resolutions": { - "@tryghost/logging": "2.2.4", + "@tryghost/logging": "2.3.0", "moment": "2.24.0", "moment-timezone": "0.5.23" }, diff --git a/yarn.lock b/yarn.lock index 71d5e865c2..37c430d136 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3420,10 +3420,10 @@ lodash "^4.17.21" luxon "^1.26.0" -"@tryghost/logging@2.2.3", "@tryghost/logging@2.2.4", "@tryghost/logging@^2.2.3": - version "2.2.4" - resolved "https://registry.yarnpkg.com/@tryghost/logging/-/logging-2.2.4.tgz#3e2ad6745fdc4d98ad80c632ef69e8ea8177e41c" - integrity sha512-r0WhWkmEScr/jL5wF9W/tMZI8hF8EOq8eVzDlDbk7qPczRyIHQcLTOxb/iWgkqeGEOP4RwCrqtMmKSlqIO8ZVQ== +"@tryghost/logging@2.2.3", "@tryghost/logging@2.2.4", "@tryghost/logging@2.3.0", "@tryghost/logging@^2.2.3": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@tryghost/logging/-/logging-2.3.0.tgz#8a55d01ef058461d0e84fa02f403cb1e229afbd7" + integrity sha512-OPGXCmRW4UN28KSGfIcSTP6VE4L+Cfn9Q5iE/cYa1QwO5ykKPirOmh98WH+9PhzxLz/5dZvXeAxqXj5w9dphEA== dependencies: "@tryghost/bunyan-rotating-filestream" "^0.0.7" "@tryghost/elasticsearch" "^3.0.3"