@salesforce/core 2.35.3 → 2.36.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/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
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
+ ## [2.36.0](https://github.com/forcedotcom/sfdx-core/compare/v2.35.3...v2.36.0) (2022-03-23)
6
+
7
+ ### Features
8
+
9
+ - rotating log file ([d185e00](https://github.com/forcedotcom/sfdx-core/commit/d185e00aa66fc558f3c0d710cb2fafa0655a9fbc))
10
+
11
+ ### Bug Fixes
12
+
13
+ - bump jsforce types ([ddacb98](https://github.com/forcedotcom/sfdx-core/commit/ddacb987068d00aec2147130f3464232a6bdccdf))
14
+ - check env before resetting ([abf6ea1](https://github.com/forcedotcom/sfdx-core/commit/abf6ea1bd721f773c09f346ff9ae8d01a915e5cd))
15
+
5
16
  ### [2.35.3](https://github.com/forcedotcom/sfdx-core/compare/v2.35.2...v2.35.3) (2022-02-23)
6
17
 
7
18
  ### Bug Fixes
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 sfdx.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
@@ -72,6 +72,17 @@ class Logger {
72
72
  * `Logger`.
73
73
  */
74
74
  constructor(optionsOrName) {
75
+ /**
76
+ * The default rotation period for logs. Example '1d' will rotate logs daily (at midnight).
77
+ * See 'period' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file
78
+ */
79
+ this.logRotationPeriod = new kit_1.Env().getString('SFDX_LOG_ROTATION_PERIOD') || '1d';
80
+ /**
81
+ * The number of backup rotated log files to keep.
82
+ * Example: '3' will have the base sfdx.log file, and the past 3 (period) log files.
83
+ * See 'count' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file
84
+ */
85
+ this.logRotationCount = new kit_1.Env().getNumber('SFDX_LOG_ROTATION_COUNT') || 2;
75
86
  /**
76
87
  * Whether debug is enabled for this Logger.
77
88
  */
@@ -250,12 +261,12 @@ class Logger {
250
261
  if (!this.bunyan.streams.find(
251
262
  // No bunyan typings
252
263
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
253
- (stream) => stream.type === 'file' && stream.path === logFile)) {
254
- // TODO: rotating-file
255
- // https://github.com/trentm/node-bunyan#stream-type-rotating-file
264
+ (stream) => stream.type === 'rotating-file' && stream.path === logFile)) {
256
265
  this.addStream({
257
- type: 'file',
266
+ type: 'rotating-file',
258
267
  path: logFile,
268
+ period: this.logRotationPeriod,
269
+ count: this.logRotationCount,
259
270
  level: this.bunyan.level(),
260
271
  });
261
272
  }
@@ -290,12 +301,12 @@ class Logger {
290
301
  if (!this.bunyan.streams.find(
291
302
  // No bunyan typings
292
303
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
293
- (stream) => stream.type === 'file' && stream.path === logFile)) {
294
- // TODO: rotating-file
295
- // https://github.com/trentm/node-bunyan#stream-type-rotating-file
304
+ (stream) => stream.type === 'rotating-file' && stream.path === logFile)) {
296
305
  this.addStream({
297
- type: 'file',
306
+ type: 'rotating-file',
298
307
  path: logFile,
308
+ period: this.logRotationPeriod,
309
+ count: this.logRotationCount,
299
310
  level: this.bunyan.level(),
300
311
  });
301
312
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "2.35.3",
3
+ "version": "2.36.0",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",
@@ -39,7 +39,7 @@
39
39
  "@salesforce/schemas": "^1.0.1",
40
40
  "@salesforce/ts-types": "^1.5.20",
41
41
  "@types/graceful-fs": "^4.1.5",
42
- "@types/jsforce": "^1.9.38",
42
+ "@types/jsforce": "^1.9.41",
43
43
  "@types/mkdirp": "^1.0.1",
44
44
  "archiver": "^5.3.0",
45
45
  "debug": "^3.1.0",