@platformatic/service 2.0.0-alpha.8 → 2.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.d.ts +3 -0
- package/lib/plugins/metrics.js +1 -1
- package/lib/stackable.js +8 -3
- package/lib/utils.js +12 -10
- package/package.json +24 -26
- package/schema.json +5 -2
package/config.d.ts
CHANGED
package/lib/plugins/metrics.js
CHANGED
|
@@ -170,7 +170,7 @@ async function createMetricsServer (app, hostname, port) {
|
|
|
170
170
|
httpServer.on('request', handler)
|
|
171
171
|
return httpServer
|
|
172
172
|
},
|
|
173
|
-
|
|
173
|
+
loggerInstance: app.log.child({ name: 'prometheus' }),
|
|
174
174
|
})
|
|
175
175
|
|
|
176
176
|
app.addHook('onClose', async () => {
|
package/lib/stackable.js
CHANGED
|
@@ -82,8 +82,9 @@ class ServiceStackable {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
async getConfig () {
|
|
85
|
-
const config = this.configManager.current
|
|
86
|
-
|
|
85
|
+
const config = Object.assign({}, this.configManager.current)
|
|
86
|
+
config.server = Object.assign({}, config.server)
|
|
87
|
+
const logger = config.server.loggerInstance
|
|
87
88
|
|
|
88
89
|
if (logger) {
|
|
89
90
|
config.server.logger = {}
|
|
@@ -93,6 +94,8 @@ class ServiceStackable {
|
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
delete config.server.loggerInstance
|
|
98
|
+
|
|
96
99
|
return config
|
|
97
100
|
}
|
|
98
101
|
|
|
@@ -247,7 +250,9 @@ class ServiceStackable {
|
|
|
247
250
|
pinoOptions.name = this.context.serviceId
|
|
248
251
|
}
|
|
249
252
|
|
|
250
|
-
|
|
253
|
+
// Only one of logger and loggerInstance should be set
|
|
254
|
+
delete this.configManager.current.server.logger
|
|
255
|
+
this.configManager.current.server.loggerInstance = pino(pinoOptions)
|
|
251
256
|
}
|
|
252
257
|
}
|
|
253
258
|
|
package/lib/utils.js
CHANGED
|
@@ -21,17 +21,19 @@ function addLoggerToTheConfig (config) {
|
|
|
21
21
|
config.server = {}
|
|
22
22
|
}
|
|
23
23
|
// Set the logger if not present
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
if (!config.server.loggerInstance) {
|
|
25
|
+
let logger = config.server.logger
|
|
26
|
+
if (!logger) {
|
|
27
|
+
config.server.logger = { level: 'info' }
|
|
28
|
+
logger = config.server.logger
|
|
29
|
+
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
// If TTY use pino-pretty
|
|
32
|
+
if (isatty(1)) {
|
|
33
|
+
if (!logger.transport) {
|
|
34
|
+
logger.transport = {
|
|
35
|
+
target: 'pino-pretty',
|
|
36
|
+
}
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/service",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"homepage": "https://github.com/platformatic/platformatic#readme",
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@fastify/aws-lambda": "^4.0.0",
|
|
21
|
-
"@fastify/compress": "^
|
|
21
|
+
"@fastify/compress": "^8.0.0",
|
|
22
22
|
"bindings": "^1.5.0",
|
|
23
23
|
"borp": "^0.17.0",
|
|
24
24
|
"eslint": "9",
|
|
25
25
|
"json-schema-to-typescript": "^15.0.0",
|
|
26
26
|
"neostandard": "^0.11.1",
|
|
27
27
|
"openapi-types": "^12.1.3",
|
|
28
|
-
"pino-abstract-transport": "^
|
|
28
|
+
"pino-abstract-transport": "^2.0.0",
|
|
29
29
|
"self-cert": "^2.0.0",
|
|
30
30
|
"split2": "^4.2.0",
|
|
31
31
|
"strip-ansi": "^7.1.0",
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
"yaml": "^2.4.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@fastify/accepts": "^
|
|
41
|
-
"@fastify/autoload": "^
|
|
42
|
-
"@fastify/basic-auth": "^
|
|
43
|
-
"@fastify/cors": "^
|
|
44
|
-
"@fastify/deepmerge": "^
|
|
45
|
-
"@fastify/error": "^
|
|
46
|
-
"@fastify/static": "^
|
|
47
|
-
"@fastify/swagger": "^
|
|
48
|
-
"@fastify/under-pressure": "^
|
|
49
|
-
"@mercuriusjs/federation": "^
|
|
40
|
+
"@fastify/accepts": "^5.0.0",
|
|
41
|
+
"@fastify/autoload": "^6.0.0",
|
|
42
|
+
"@fastify/basic-auth": "^6.0.0",
|
|
43
|
+
"@fastify/cors": "^10.0.0",
|
|
44
|
+
"@fastify/deepmerge": "^2.0.0",
|
|
45
|
+
"@fastify/error": "^4.0.0",
|
|
46
|
+
"@fastify/static": "^8.0.0",
|
|
47
|
+
"@fastify/swagger": "^9.0.0",
|
|
48
|
+
"@fastify/under-pressure": "^9.0.0",
|
|
49
|
+
"@mercuriusjs/federation": "^4.0.0",
|
|
50
50
|
"@platformatic/fastify-http-metrics": "^0.1.0",
|
|
51
51
|
"@scalar/fastify-api-reference": "^1.19.5",
|
|
52
52
|
"@types/ws": "^8.5.10",
|
|
@@ -61,29 +61,27 @@
|
|
|
61
61
|
"env-schema": "^5.2.1",
|
|
62
62
|
"es-main": "^1.3.0",
|
|
63
63
|
"execa": "^8.0.1",
|
|
64
|
-
"fastify": "
|
|
65
|
-
"fastify-
|
|
66
|
-
"fastify-openapi-glue": "^4.4.3",
|
|
67
|
-
"fastify-plugin": "^4.5.1",
|
|
64
|
+
"fastify": "5.0.0-alpha.4",
|
|
65
|
+
"fastify-plugin": "^5.0.0",
|
|
68
66
|
"graphql": "^16.9.0",
|
|
69
67
|
"help-me": "^5.0.0",
|
|
70
|
-
"mercurius": "^
|
|
68
|
+
"mercurius": "^15.0.0",
|
|
71
69
|
"minimist": "^1.2.8",
|
|
72
70
|
"my-ua-parser": "^2.0.2",
|
|
73
71
|
"ora": "^6.3.1",
|
|
74
|
-
"pino": "^
|
|
72
|
+
"pino": "^9.0.0",
|
|
75
73
|
"pino-pretty": "^11.0.0",
|
|
76
74
|
"prom-client": "^15.1.2",
|
|
77
75
|
"rfdc": "^1.3.1",
|
|
78
76
|
"semgrator": "^0.3.0",
|
|
79
77
|
"undici": "^6.9.0",
|
|
80
|
-
"@platformatic/client": "2.0.0-alpha.
|
|
81
|
-
"@platformatic/generators": "2.0.0-alpha.
|
|
82
|
-
"@platformatic/
|
|
83
|
-
"@platformatic/
|
|
84
|
-
"@platformatic/telemetry": "2.0.0-alpha.
|
|
85
|
-
"@platformatic/ts-compiler": "2.0.0-alpha.
|
|
86
|
-
"@platformatic/utils": "2.0.0-alpha.
|
|
78
|
+
"@platformatic/client": "2.0.0-alpha.9",
|
|
79
|
+
"@platformatic/generators": "2.0.0-alpha.9",
|
|
80
|
+
"@platformatic/config": "2.0.0-alpha.9",
|
|
81
|
+
"@platformatic/scalar-theme": "2.0.0-alpha.9",
|
|
82
|
+
"@platformatic/telemetry": "2.0.0-alpha.9",
|
|
83
|
+
"@platformatic/ts-compiler": "2.0.0-alpha.9",
|
|
84
|
+
"@platformatic/utils": "2.0.0-alpha.9"
|
|
87
85
|
},
|
|
88
86
|
"scripts": {
|
|
89
87
|
"test": "pnpm run lint && borp -T --concurrency=1 --timeout=180000 && tsd",
|
package/schema.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/service/2.0.0-alpha.
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/service/2.0.0-alpha.9.json",
|
|
3
|
+
"version": "2.0.0-alpha.9",
|
|
4
4
|
"title": "Platformatic Service",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
@@ -158,6 +158,9 @@
|
|
|
158
158
|
}
|
|
159
159
|
]
|
|
160
160
|
},
|
|
161
|
+
"loggerInstance": {
|
|
162
|
+
"type": "object"
|
|
163
|
+
},
|
|
161
164
|
"serializerOpts": {
|
|
162
165
|
"type": "object",
|
|
163
166
|
"properties": {
|