@platformatic/foundation 3.44.0 → 3.46.0
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/lib/cli.js +19 -7
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Deepmerge from '@fastify/deepmerge'
|
|
1
2
|
import { bgGreen, black, bold, green, isColorSupported } from 'colorette'
|
|
2
3
|
import { resolve } from 'node:path'
|
|
3
4
|
import { parseArgs as nodeParseArgs } from 'node:util'
|
|
@@ -5,6 +6,7 @@ import { pino } from 'pino'
|
|
|
5
6
|
import pinoPretty from 'pino-pretty'
|
|
6
7
|
import { findConfigurationFileRecursive, loadConfigurationModule, saveConfigurationFile } from './configuration.js'
|
|
7
8
|
import { hasJavascriptFiles } from './file-system.js'
|
|
9
|
+
import { setPinoTimestamp } from './logger.js'
|
|
8
10
|
import { detectApplicationType, getPlatformaticVersion } from './module.js'
|
|
9
11
|
|
|
10
12
|
/* c8 ignore next 4 - else branches */
|
|
@@ -111,7 +113,7 @@ export function logo (color = true, name = undefined) {
|
|
|
111
113
|
return color && isColorSupported ? str.replace(/\//g, s => green(s)) : str
|
|
112
114
|
}
|
|
113
115
|
|
|
114
|
-
export function createCliLogger (level, noPretty) {
|
|
116
|
+
export function createCliLogger (level, noPretty = false, loggerConfig = {}) {
|
|
115
117
|
let pretty
|
|
116
118
|
|
|
117
119
|
/* c8 ignore next 3 - Covered elsewhere */
|
|
@@ -130,13 +132,23 @@ export function createCliLogger (level, noPretty) {
|
|
|
130
132
|
})
|
|
131
133
|
}
|
|
132
134
|
|
|
135
|
+
const resolvedConfig = { ...loggerConfig }
|
|
136
|
+
if (typeof resolvedConfig.timestamp === 'string') {
|
|
137
|
+
setPinoTimestamp(resolvedConfig)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const dm = Deepmerge()
|
|
141
|
+
|
|
133
142
|
return pino(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
143
|
+
dm(
|
|
144
|
+
{
|
|
145
|
+
level,
|
|
146
|
+
customLevels: {
|
|
147
|
+
done: 35
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
resolvedConfig
|
|
151
|
+
),
|
|
140
152
|
pretty
|
|
141
153
|
)
|
|
142
154
|
}
|