@netlify/build 27.9.0 → 27.9.1
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/package.json +1 -1
- package/src/log/logger.js +13 -4
package/package.json
CHANGED
package/src/log/logger.js
CHANGED
|
@@ -125,13 +125,22 @@ const reduceLogLines = function (lines) {
|
|
|
125
125
|
// Builds a function for logging data to the system logger (i.e. hidden from
|
|
126
126
|
// the user-facing build logs)
|
|
127
127
|
export const getSystemLogger = function (logs, debug, systemLogFile) {
|
|
128
|
-
// If
|
|
129
|
-
//
|
|
130
|
-
|
|
131
|
-
if (!systemLogFile || debug) {
|
|
128
|
+
// If the `debug` flag is used, we return a function that pipes system logs
|
|
129
|
+
// to the regular logger, as the intention is for them to end up in stdout.
|
|
130
|
+
if (debug) {
|
|
132
131
|
return (...args) => log(logs, reduceLogLines(args))
|
|
133
132
|
}
|
|
134
133
|
|
|
134
|
+
// If there's not a file descriptor configured for system logs and `debug`
|
|
135
|
+
// is not set, we return a no-op function that will swallow the errors.
|
|
136
|
+
if (!systemLogFile) {
|
|
137
|
+
return () => {
|
|
138
|
+
// no-op
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Return a function that writes to the file descriptor configured for system
|
|
143
|
+
// logs.
|
|
135
144
|
const fileDescriptor = createWriteStream(null, { fd: systemLogFile })
|
|
136
145
|
|
|
137
146
|
fileDescriptor.on('error', () => {
|