Added logging configuration option for timestamps to use the local timezone

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
This commit is contained in:
Daniel Lockyer 2022-08-31 10:01:34 +01:00
parent e897efe842
commit 7a2f766668
No known key found for this signature in database
GPG Key ID: D21186F0B47295AD
11 changed files with 17 additions and 16 deletions

View File

@ -22,6 +22,6 @@
"sinon": "14.0.0"
},
"dependencies": {
"@tryghost/logging": "2.2.4"
"@tryghost/logging": "2.3.0"
}
}

View File

@ -52,6 +52,7 @@
},
"logging": {
"level": "info",
"useLocalTime": false,
"rotation": {
"enabled": false,
"period": "1d",

View File

@ -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"
}

View File

@ -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",

View File

@ -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"

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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"
},

View File

@ -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"