@salesforce/core 3.10.0 → 3.10.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/CHANGELOG.md +6 -0
- package/lib/config/envVars.d.ts +4 -0
- package/lib/config/envVars.js +20 -0
- package/lib/logger.d.ts +11 -0
- package/lib/logger.js +19 -8
- package/messages/envVars.md +16 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [3.10.1](https://github.com/forcedotcom/sfdx-core/compare/v3.10.0...v3.10.1) (2022-03-24)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- rotating file logs ([ef5df25](https://github.com/forcedotcom/sfdx-core/commit/ef5df25c17a67541d12d5c228c18b75775251d98))
|
|
10
|
+
|
|
5
11
|
## [3.10.0](https://github.com/forcedotcom/sfdx-core/compare/v3.9.0...v3.10.0) (2022-03-23)
|
|
6
12
|
|
|
7
13
|
### Features
|
package/lib/config/envVars.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export declare enum EnvironmentVariable {
|
|
|
26
26
|
'SFDX_INSTANCE_URL' = "SFDX_INSTANCE_URL",
|
|
27
27
|
'SFDX_JSON_TO_STDOUT' = "SFDX_JSON_TO_STDOUT",
|
|
28
28
|
'SFDX_LOG_LEVEL' = "SFDX_LOG_LEVEL",
|
|
29
|
+
'SFDX_LOG_ROTATION_COUNT' = "SFDX_LOG_ROTATION_COUNT",
|
|
30
|
+
'SFDX_LOG_ROTATION_PERIOD' = "SFDX_LOG_ROTATION_PERIOD",
|
|
29
31
|
'SFDX_MAX_QUERY_LIMIT' = "SFDX_MAX_QUERY_LIMIT",
|
|
30
32
|
'SFDX_MDAPI_TEMP_DIR' = "SFDX_MDAPI_TEMP_DIR",
|
|
31
33
|
'SFDX_NPM_REGISTRY' = "SFDX_NPM_REGISTRY",
|
|
@@ -58,6 +60,8 @@ export declare enum EnvironmentVariable {
|
|
|
58
60
|
'SF_INSTANCE_URL' = "SF_INSTANCE_URL",
|
|
59
61
|
'SF_JSON_TO_STDOUT' = "SF_JSON_TO_STDOUT",
|
|
60
62
|
'SF_LOG_LEVEL' = "SF_LOG_LEVEL",
|
|
63
|
+
'SF_LOG_ROTATION_COUNT' = "SF_LOG_ROTATION_COUNT",
|
|
64
|
+
'SF_LOG_ROTATION_PERIOD' = "SF_LOG_ROTATION_PERIOD",
|
|
61
65
|
'SF_MAX_QUERY_LIMIT' = "SF_MAX_QUERY_LIMIT",
|
|
62
66
|
'SF_MDAPI_TEMP_DIR' = "SF_MDAPI_TEMP_DIR",
|
|
63
67
|
'SF_NPM_REGISTRY' = "SF_NPM_REGISTRY",
|
package/lib/config/envVars.js
CHANGED
|
@@ -40,6 +40,8 @@ var EnvironmentVariable;
|
|
|
40
40
|
EnvironmentVariable["SFDX_INSTANCE_URL"] = "SFDX_INSTANCE_URL";
|
|
41
41
|
EnvironmentVariable["SFDX_JSON_TO_STDOUT"] = "SFDX_JSON_TO_STDOUT";
|
|
42
42
|
EnvironmentVariable["SFDX_LOG_LEVEL"] = "SFDX_LOG_LEVEL";
|
|
43
|
+
EnvironmentVariable["SFDX_LOG_ROTATION_COUNT"] = "SFDX_LOG_ROTATION_COUNT";
|
|
44
|
+
EnvironmentVariable["SFDX_LOG_ROTATION_PERIOD"] = "SFDX_LOG_ROTATION_PERIOD";
|
|
43
45
|
EnvironmentVariable["SFDX_MAX_QUERY_LIMIT"] = "SFDX_MAX_QUERY_LIMIT";
|
|
44
46
|
EnvironmentVariable["SFDX_MDAPI_TEMP_DIR"] = "SFDX_MDAPI_TEMP_DIR";
|
|
45
47
|
EnvironmentVariable["SFDX_NPM_REGISTRY"] = "SFDX_NPM_REGISTRY";
|
|
@@ -72,6 +74,8 @@ var EnvironmentVariable;
|
|
|
72
74
|
EnvironmentVariable["SF_INSTANCE_URL"] = "SF_INSTANCE_URL";
|
|
73
75
|
EnvironmentVariable["SF_JSON_TO_STDOUT"] = "SF_JSON_TO_STDOUT";
|
|
74
76
|
EnvironmentVariable["SF_LOG_LEVEL"] = "SF_LOG_LEVEL";
|
|
77
|
+
EnvironmentVariable["SF_LOG_ROTATION_COUNT"] = "SF_LOG_ROTATION_COUNT";
|
|
78
|
+
EnvironmentVariable["SF_LOG_ROTATION_PERIOD"] = "SF_LOG_ROTATION_PERIOD";
|
|
75
79
|
EnvironmentVariable["SF_MAX_QUERY_LIMIT"] = "SF_MAX_QUERY_LIMIT";
|
|
76
80
|
EnvironmentVariable["SF_MDAPI_TEMP_DIR"] = "SF_MDAPI_TEMP_DIR";
|
|
77
81
|
EnvironmentVariable["SF_NPM_REGISTRY"] = "SF_NPM_REGISTRY";
|
|
@@ -186,6 +190,14 @@ exports.SUPPORTED_ENV_VARS = {
|
|
|
186
190
|
description: getMessage(EnvironmentVariable.SFDX_LOG_LEVEL),
|
|
187
191
|
synonymOf: EnvironmentVariable.SF_LOG_LEVEL,
|
|
188
192
|
},
|
|
193
|
+
[EnvironmentVariable.SFDX_LOG_ROTATION_COUNT]: {
|
|
194
|
+
description: getMessage(EnvironmentVariable.SFDX_LOG_ROTATION_COUNT),
|
|
195
|
+
synonymOf: EnvironmentVariable.SF_LOG_ROTATION_COUNT,
|
|
196
|
+
},
|
|
197
|
+
[EnvironmentVariable.SFDX_LOG_ROTATION_PERIOD]: {
|
|
198
|
+
description: getMessage(EnvironmentVariable.SFDX_LOG_ROTATION_PERIOD),
|
|
199
|
+
synonymOf: EnvironmentVariable.SF_LOG_ROTATION_PERIOD,
|
|
200
|
+
},
|
|
189
201
|
[EnvironmentVariable.SFDX_MAX_QUERY_LIMIT]: {
|
|
190
202
|
description: getMessage(EnvironmentVariable.SFDX_MAX_QUERY_LIMIT),
|
|
191
203
|
synonymOf: EnvironmentVariable.SF_MAX_QUERY_LIMIT,
|
|
@@ -315,6 +327,14 @@ exports.SUPPORTED_ENV_VARS = {
|
|
|
315
327
|
description: getMessage(EnvironmentVariable.SF_LOG_LEVEL),
|
|
316
328
|
synonymOf: null,
|
|
317
329
|
},
|
|
330
|
+
[EnvironmentVariable.SF_LOG_ROTATION_COUNT]: {
|
|
331
|
+
description: getMessage(EnvironmentVariable.SF_LOG_ROTATION_COUNT),
|
|
332
|
+
synonymOf: null,
|
|
333
|
+
},
|
|
334
|
+
[EnvironmentVariable.SF_LOG_ROTATION_PERIOD]: {
|
|
335
|
+
description: getMessage(EnvironmentVariable.SF_LOG_ROTATION_PERIOD),
|
|
336
|
+
synonymOf: null,
|
|
337
|
+
},
|
|
318
338
|
[EnvironmentVariable.SF_MAX_QUERY_LIMIT]: {
|
|
319
339
|
description: getMessage(EnvironmentVariable.SF_MAX_QUERY_LIMIT),
|
|
320
340
|
synonymOf: null,
|
package/lib/logger.d.ts
CHANGED
|
@@ -163,6 +163,17 @@ export declare class Logger {
|
|
|
163
163
|
static readonly LEVEL_NAMES: string[];
|
|
164
164
|
private static readonly lifecycle;
|
|
165
165
|
private static rootLogger?;
|
|
166
|
+
/**
|
|
167
|
+
* The default rotation period for logs. Example '1d' will rotate logs daily (at midnight).
|
|
168
|
+
* See 'period' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file
|
|
169
|
+
*/
|
|
170
|
+
readonly logRotationPeriod: string;
|
|
171
|
+
/**
|
|
172
|
+
* The number of backup rotated log files to keep.
|
|
173
|
+
* Example: '3' will have the base sf.log file, and the past 3 (period) log files.
|
|
174
|
+
* See 'count' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file
|
|
175
|
+
*/
|
|
176
|
+
readonly logRotationCount: number;
|
|
166
177
|
/**
|
|
167
178
|
* Whether debug is enabled for this Logger.
|
|
168
179
|
*/
|
package/lib/logger.js
CHANGED
|
@@ -74,6 +74,17 @@ class Logger {
|
|
|
74
74
|
* `Logger`.
|
|
75
75
|
*/
|
|
76
76
|
constructor(optionsOrName) {
|
|
77
|
+
/**
|
|
78
|
+
* The default rotation period for logs. Example '1d' will rotate logs daily (at midnight).
|
|
79
|
+
* See 'period' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file
|
|
80
|
+
*/
|
|
81
|
+
this.logRotationPeriod = new kit_1.Env().getString('SF_LOG_ROTATION_PERIOD') || '1d';
|
|
82
|
+
/**
|
|
83
|
+
* The number of backup rotated log files to keep.
|
|
84
|
+
* Example: '3' will have the base sf.log file, and the past 3 (period) log files.
|
|
85
|
+
* See 'count' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file
|
|
86
|
+
*/
|
|
87
|
+
this.logRotationCount = new kit_1.Env().getNumber('SF_LOG_ROTATION_COUNT') || 2;
|
|
77
88
|
/**
|
|
78
89
|
* Whether debug is enabled for this Logger.
|
|
79
90
|
*/
|
|
@@ -252,12 +263,12 @@ class Logger {
|
|
|
252
263
|
if (!this.bunyan.streams.find(
|
|
253
264
|
// No bunyan typings
|
|
254
265
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
255
|
-
(stream) => stream.type === 'file' && stream.path === logFile)) {
|
|
256
|
-
// TODO: rotating-file
|
|
257
|
-
// https://github.com/trentm/node-bunyan#stream-type-rotating-file
|
|
266
|
+
(stream) => stream.type === 'rotating-file' && stream.path === logFile)) {
|
|
258
267
|
this.addStream({
|
|
259
|
-
type: 'file',
|
|
268
|
+
type: 'rotating-file',
|
|
260
269
|
path: logFile,
|
|
270
|
+
period: this.logRotationPeriod,
|
|
271
|
+
count: this.logRotationCount,
|
|
261
272
|
level: this.bunyan.level(),
|
|
262
273
|
});
|
|
263
274
|
}
|
|
@@ -292,12 +303,12 @@ class Logger {
|
|
|
292
303
|
if (!this.bunyan.streams.find(
|
|
293
304
|
// No bunyan typings
|
|
294
305
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
295
|
-
(stream) => stream.type === 'file' && stream.path === logFile)) {
|
|
296
|
-
// TODO: rotating-file
|
|
297
|
-
// https://github.com/trentm/node-bunyan#stream-type-rotating-file
|
|
306
|
+
(stream) => stream.type === 'rotating-file' && stream.path === logFile)) {
|
|
298
307
|
this.addStream({
|
|
299
|
-
type: 'file',
|
|
308
|
+
type: 'rotating-file',
|
|
300
309
|
path: logFile,
|
|
310
|
+
period: this.logRotationPeriod,
|
|
311
|
+
count: this.logRotationCount,
|
|
301
312
|
level: this.bunyan.level(),
|
|
302
313
|
});
|
|
303
314
|
}
|
package/messages/envVars.md
CHANGED
|
@@ -94,6 +94,14 @@ Set to true to send messages resulting from failed Salesforce CLI commands to st
|
|
|
94
94
|
|
|
95
95
|
Level of messages that the CLI writes to the log file. Valid values are trace, debug, info, warn, error, fatal. Default value is warn.
|
|
96
96
|
|
|
97
|
+
# sfdxLogRotationCount
|
|
98
|
+
|
|
99
|
+
The default rotation period for logs. Example '1d' will rotate logs daily (at midnight).
|
|
100
|
+
|
|
101
|
+
# sfdxLogRotationPeriod
|
|
102
|
+
|
|
103
|
+
The number of backup rotated log files to keep. Example: '3' will have the base sf.log file, and the past 3 (period) log files.
|
|
104
|
+
|
|
97
105
|
# sfdxMaxQueryLimit
|
|
98
106
|
|
|
99
107
|
Maximum number of Salesforce records returned by a CLI command. Default value is 10,000. Overrides the maxQueryLimit configuration value.
|
|
@@ -222,6 +230,14 @@ Set to true to send messages resulting from failed Salesforce CLI commands to st
|
|
|
222
230
|
|
|
223
231
|
Level of messages that the CLI writes to the log file. Valid values are trace, debug, info, warn, error, fatal. Default value is warn.
|
|
224
232
|
|
|
233
|
+
# sfLogRotationCount
|
|
234
|
+
|
|
235
|
+
The default rotation period for logs. Example '1d' will rotate logs daily (at midnight).
|
|
236
|
+
|
|
237
|
+
# sfLogRotationPeriod
|
|
238
|
+
|
|
239
|
+
The number of backup rotated log files to keep. Example: '3' will have the base sf.log file, and the past 3 (period) log files.
|
|
240
|
+
|
|
225
241
|
# sfMaxQueryLimit
|
|
226
242
|
|
|
227
243
|
Maximum number of Salesforce records returned by a CLI command. Default value is 10,000. Overrides the maxQueryLimit configuration variable.
|