@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 CHANGED
@@ -61,6 +61,9 @@ export interface PlatformaticService {
61
61
  };
62
62
  [k: string]: unknown;
63
63
  };
64
+ loggerInstance?: {
65
+ [k: string]: unknown;
66
+ };
64
67
  serializerOpts?: {
65
68
  schema?: {
66
69
  [k: string]: unknown;
@@ -170,7 +170,7 @@ async function createMetricsServer (app, hostname, port) {
170
170
  httpServer.on('request', handler)
171
171
  return httpServer
172
172
  },
173
- logger: app.log.child({ name: 'prometheus' }),
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
- const logger = config.server.logger
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
- this.configManager.current.server.logger = pino(pinoOptions)
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
- let logger = config.server.logger
25
- if (!logger) {
26
- config.server.logger = { level: 'info' }
27
- logger = config.server.logger
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
- // If TTY use pino-pretty
31
- if (isatty(1)) {
32
- if (!logger.transport) {
33
- logger.transport = {
34
- target: 'pino-pretty',
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.8",
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": "^7.0.0",
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": "^1.1.0",
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": "^4.3.0",
41
- "@fastify/autoload": "^5.8.0",
42
- "@fastify/basic-auth": "^5.1.1",
43
- "@fastify/cors": "^9.0.1",
44
- "@fastify/deepmerge": "^1.3.0",
45
- "@fastify/error": "^3.4.1",
46
- "@fastify/static": "^7.0.1",
47
- "@fastify/swagger": "^8.14.0",
48
- "@fastify/under-pressure": "^8.3.0",
49
- "@mercuriusjs/federation": "^3.0.0",
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": "^4.28.1",
65
- "fastify-metrics": "^11.0.0",
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": "^14.0.0",
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": "^8.19.0",
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.8",
81
- "@platformatic/generators": "2.0.0-alpha.8",
82
- "@platformatic/scalar-theme": "2.0.0-alpha.8",
83
- "@platformatic/config": "2.0.0-alpha.8",
84
- "@platformatic/telemetry": "2.0.0-alpha.8",
85
- "@platformatic/ts-compiler": "2.0.0-alpha.8",
86
- "@platformatic/utils": "2.0.0-alpha.8"
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.8.json",
3
- "version": "2.0.0-alpha.8",
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": {