@salesforce/core 4.3.11 → 5.0.1-v5-beta.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.
Files changed (51) hide show
  1. package/lib/config/config.js +1 -1
  2. package/lib/config/configFile.d.ts +1 -1
  3. package/lib/config/configFile.js +1 -1
  4. package/lib/crypto/crypto.js +1 -1
  5. package/lib/crypto/keyChain.js +1 -1
  6. package/lib/deviceOauthService.js +1 -1
  7. package/lib/exported.d.ts +1 -1
  8. package/lib/exported.js +1 -1
  9. package/lib/global.d.ts +0 -4
  10. package/lib/global.js +0 -6
  11. package/lib/lifecycleEvents.d.ts +1 -1
  12. package/lib/lifecycleEvents.js +9 -4
  13. package/lib/logger/cleanup.d.ts +11 -0
  14. package/lib/logger/cleanup.js +57 -0
  15. package/lib/logger/filters.d.ts +7 -0
  16. package/lib/logger/filters.js +69 -0
  17. package/lib/{logger.d.ts → logger/logger.d.ts} +34 -155
  18. package/lib/logger/logger.js +399 -0
  19. package/lib/logger/memoryLogger.d.ts +10 -0
  20. package/lib/logger/memoryLogger.js +30 -0
  21. package/lib/logger/transformStream.d.ts +3 -0
  22. package/lib/logger/transformStream.js +57 -0
  23. package/lib/org/authInfo.js +1 -1
  24. package/lib/org/authRemover.js +1 -1
  25. package/lib/org/connection.js +2 -2
  26. package/lib/org/org.js +27 -22
  27. package/lib/org/permissionSetAssignment.js +1 -1
  28. package/lib/org/scratchOrgCreate.js +1 -1
  29. package/lib/org/scratchOrgErrorCodes.js +1 -1
  30. package/lib/org/scratchOrgInfoApi.js +1 -1
  31. package/lib/org/scratchOrgLifecycleEvents.js +2 -3
  32. package/lib/org/scratchOrgSettingsGenerator.js +1 -1
  33. package/lib/org/user.js +1 -1
  34. package/lib/schema/printer.d.ts +1 -1
  35. package/lib/schema/validator.d.ts +1 -1
  36. package/lib/stateAggregator/accessors/orgAccessor.js +1 -1
  37. package/lib/status/myDomainResolver.js +1 -1
  38. package/lib/status/pollingClient.d.ts +1 -1
  39. package/lib/status/pollingClient.js +1 -1
  40. package/lib/status/streamingClient.js +1 -1
  41. package/lib/testSetup.d.ts +1 -1
  42. package/lib/testSetup.js +2 -2
  43. package/lib/util/sfdc.d.ts +2 -0
  44. package/lib/util/sfdc.js +4 -2
  45. package/lib/util/sfdcUrl.js +1 -1
  46. package/lib/util/unwrapArray.d.ts +1 -0
  47. package/lib/util/unwrapArray.js +17 -0
  48. package/lib/util/zipWriter.js +1 -1
  49. package/lib/webOAuthServer.js +1 -1
  50. package/package.json +5 -5
  51. package/lib/logger.js +0 -737
@@ -0,0 +1,399 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Logger = exports.LoggerLevel = void 0;
4
+ /*
5
+ * Copyright (c) 2020, salesforce.com, inc.
6
+ * All rights reserved.
7
+ * Licensed under the BSD 3-Clause license.
8
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
+ */
10
+ const os = require("os");
11
+ const path = require("path");
12
+ const pino_1 = require("pino");
13
+ const kit_1 = require("@salesforce/kit");
14
+ const ts_types_1 = require("@salesforce/ts-types");
15
+ const global_1 = require("../global");
16
+ const sfError_1 = require("../sfError");
17
+ const unwrapArray_1 = require("../util/unwrapArray");
18
+ const memoryLogger_1 = require("./memoryLogger");
19
+ const cleanup_1 = require("./cleanup");
20
+ /**
21
+ * Standard `Logger` levels.
22
+ *
23
+ * **See** {@link https://getpino.io/#/docs/api?id=logger-level |Logger Levels}
24
+ */
25
+ var LoggerLevel;
26
+ (function (LoggerLevel) {
27
+ LoggerLevel[LoggerLevel["TRACE"] = 10] = "TRACE";
28
+ LoggerLevel[LoggerLevel["DEBUG"] = 20] = "DEBUG";
29
+ LoggerLevel[LoggerLevel["INFO"] = 30] = "INFO";
30
+ LoggerLevel[LoggerLevel["WARN"] = 40] = "WARN";
31
+ LoggerLevel[LoggerLevel["ERROR"] = 50] = "ERROR";
32
+ LoggerLevel[LoggerLevel["FATAL"] = 60] = "FATAL";
33
+ })(LoggerLevel = exports.LoggerLevel || (exports.LoggerLevel = {}));
34
+ /**
35
+ * A logging abstraction powered by {@link https://github.com/pinojs/pino | Pino} that provides both a default
36
+ * logger configuration that will log to the default path, and a way to create custom loggers based on the same foundation.
37
+ *
38
+ * ```
39
+ * // Gets the root sfdx logger
40
+ * const logger = await Logger.root();
41
+ *
42
+ * // Creates a child logger of the root sfdx logger with custom fields applied
43
+ * const childLogger = await Logger.child('myRootChild', {tag: 'value'});
44
+ *
45
+ * // Creates a custom logger unaffiliated with the root logger
46
+ * const myCustomLogger = new Logger('myCustomLogger');
47
+ *
48
+ * // Creates a child of a custom logger unaffiliated with the root logger with custom fields applied
49
+ * const myCustomChildLogger = myCustomLogger.child('myCustomChild', {tag: 'value'});
50
+ *
51
+ * // get a raw pino logger from the root instance of Logger
52
+ * // you can use these to avoid constructing another Logger wrapper class and to get better type support
53
+ * const logger = Logger.getRawRootLogger().child({name: 'foo', otherProp: 'bar'});
54
+ * logger.info({some: 'stuff'}, 'a message');
55
+ *
56
+ *
57
+ * // get a raw pino logger from the current instance
58
+ * const childLogger = await Logger.child('myRootChild', {tag: 'value'});
59
+ * const logger = childLogger.getRawLogger();
60
+ * ```
61
+ *
62
+ * **See** https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_dev_cli_log_messages.htm
63
+ */
64
+ class Logger {
65
+ /**
66
+ * Constructs a new `Logger`.
67
+ *
68
+ * @param optionsOrName A set of `LoggerOptions` or name to use with the default options.
69
+ *
70
+ * **Throws** *{@link SfError}{ name: 'RedundantRootLoggerError' }* More than one attempt is made to construct the root
71
+ * `Logger`.
72
+ */
73
+ constructor(optionsOrName) {
74
+ const options = typeof optionsOrName === 'string'
75
+ ? { name: optionsOrName, level: Logger.DEFAULT_LEVEL, fields: {} }
76
+ : optionsOrName;
77
+ if (Logger.rootLogger && options.name === Logger.ROOT_NAME) {
78
+ throw new sfError_1.SfError('Can not create another root logger.', 'RedundantRootLoggerError');
79
+ }
80
+ // if there is a rootLogger, use its Pino instance
81
+ if (Logger.rootLogger) {
82
+ this.pinoLogger = Logger.rootLogger.pinoLogger.child({ ...options.fields, name: options.name });
83
+ this.memoryLogger = Logger.rootLogger.memoryLogger; // if the root was constructed with memory logging, keep that
84
+ this.pinoLogger.trace(`Created '${options.name}' child logger instance`);
85
+ }
86
+ else {
87
+ const level = new kit_1.Env().getString('SF_LOG_LEVEL') ?? pino_1.pino.levels.labels[options.level ?? Logger.DEFAULT_LEVEL];
88
+ const commonOptions = {
89
+ name: options.name ?? Logger.ROOT_NAME,
90
+ base: options.fields ?? {},
91
+ level,
92
+ enabled: process.env.SFDX_DISABLE_LOG_FILE !== 'true' && process.env.SF_DISABLE_LOG_FILE !== 'true',
93
+ };
94
+ if (options.useMemoryLogger || global_1.Global.getEnvironmentMode() === global_1.Mode.TEST) {
95
+ this.memoryLogger = new memoryLogger_1.MemoryLogger();
96
+ this.pinoLogger = (0, pino_1.pino)({
97
+ ...commonOptions,
98
+ sync: true,
99
+ }, this.memoryLogger);
100
+ }
101
+ else {
102
+ this.pinoLogger = (0, pino_1.pino)({
103
+ ...commonOptions,
104
+ transport: {
105
+ pipeline: [
106
+ {
107
+ target: path.join('..', '..', 'lib', 'logger', 'transformStream'),
108
+ },
109
+ getWriteStream(level),
110
+ ],
111
+ },
112
+ sync: false,
113
+ });
114
+ // when a new file logger root is instantiated, we check for old log files.
115
+ // but we don't want to wait for it
116
+ // and it's async and we can't wait from a ctor anyway
117
+ void (0, cleanup_1.cleanup)();
118
+ }
119
+ Logger.rootLogger = this;
120
+ }
121
+ }
122
+ /**
123
+ *
124
+ * Gets the root logger. It's a singleton
125
+ * See also getRawLogger if you don't need the root logger
126
+ */
127
+ static async root() {
128
+ return Promise.resolve(this.getRoot());
129
+ }
130
+ /**
131
+ * Gets the root logger. It's a singleton
132
+ */
133
+ static getRoot() {
134
+ if (this.rootLogger) {
135
+ return this.rootLogger;
136
+ }
137
+ const rootLogger = (this.rootLogger = new Logger(Logger.ROOT_NAME));
138
+ return rootLogger;
139
+ }
140
+ /**
141
+ * Destroys the root `Logger`.
142
+ *
143
+ * @ignore
144
+ */
145
+ static destroyRoot() {
146
+ if (this.rootLogger) {
147
+ this.rootLogger = undefined;
148
+ }
149
+ }
150
+ /**
151
+ * Create a child of the root logger, inheriting this instance's configuration such as `level`, transports, etc.
152
+ *
153
+ * @param name The name of the child logger.
154
+ * @param fields Additional fields included in all log lines.
155
+ */
156
+ static async child(name, fields) {
157
+ return (await Logger.root()).child(name, fields);
158
+ }
159
+ /**
160
+ * Create a child of the root logger, inheriting this instance's configuration such as `level`, transports, etc.
161
+ *
162
+ * @param name The name of the child logger.
163
+ * @param fields Additional fields included in all log lines.
164
+ */
165
+ static childFromRoot(name, fields) {
166
+ return Logger.getRoot().child(name, fields);
167
+ }
168
+ /**
169
+ * Gets a numeric `LoggerLevel` value by string name.
170
+ *
171
+ * @param {string} levelName The level name to convert to a `LoggerLevel` enum value.
172
+ *
173
+ * **Throws** *{@link SfError}{ name: 'UnrecognizedLoggerLevelNameError' }* The level name was not case-insensitively recognized as a valid `LoggerLevel` value.
174
+ * @see {@Link LoggerLevel}
175
+ */
176
+ static getLevelByName(levelName) {
177
+ levelName = levelName.toUpperCase();
178
+ if (!(0, ts_types_1.isKeyOf)(LoggerLevel, levelName)) {
179
+ throw new sfError_1.SfError(`Invalid log level "${levelName}".`, 'UnrecognizedLoggerLevelNameError');
180
+ }
181
+ return LoggerLevel[levelName];
182
+ }
183
+ /** get the bare (pino) logger instead of using the class hierarchy */
184
+ static getRawRootLogger() {
185
+ return Logger.getRoot().pinoLogger;
186
+ }
187
+ /** get the bare (pino) logger instead of using the class hierarchy */
188
+ getRawLogger() {
189
+ return this.pinoLogger;
190
+ }
191
+ /**
192
+ * Gets the name of this logger.
193
+ */
194
+ getName() {
195
+ return this.pinoLogger.bindings().name ?? '';
196
+ }
197
+ /**
198
+ * Gets the current level of this logger.
199
+ */
200
+ getLevel() {
201
+ return this.pinoLogger.levelVal;
202
+ }
203
+ /**
204
+ * Set the logging level of all streams for this logger. If a specific `level` is not provided, this method will
205
+ * attempt to read it from the environment variable `SFDX_LOG_LEVEL`, and if not found,
206
+ * {@link Logger.DEFAULT_LOG_LEVEL} will be used instead. For convenience `this` object is returned.
207
+ *
208
+ * @param {LoggerLevelValue} [level] The logger level.
209
+ *
210
+ * **Throws** *{@link SfError}{ name: 'UnrecognizedLoggerLevelNameError' }* A value of `level` read from `SFDX_LOG_LEVEL`
211
+ * was invalid.
212
+ *
213
+ * ```
214
+ * // Sets the level from the environment or default value
215
+ * logger.setLevel()
216
+ *
217
+ * // Set the level from the INFO enum
218
+ * logger.setLevel(LoggerLevel.INFO)
219
+ *
220
+ * // Sets the level case-insensitively from a string value
221
+ * logger.setLevel(Logger.getLevelByName('info'))
222
+ * ```
223
+ */
224
+ setLevel(level) {
225
+ if (level == null) {
226
+ const logLevelFromEnvVar = new kit_1.Env().getString('SF_LOG_LEVEL');
227
+ level = logLevelFromEnvVar ? Logger.getLevelByName(logLevelFromEnvVar) : Logger.DEFAULT_LEVEL;
228
+ }
229
+ this.pinoLogger.level = this.pinoLogger.levels.labels[level] ?? this.pinoLogger.levels.labels[Logger.DEFAULT_LEVEL];
230
+ return this;
231
+ }
232
+ /**
233
+ * Compares the requested log level with the current log level. Returns true if
234
+ * the requested log level is greater than or equal to the current log level.
235
+ *
236
+ * @param level The requested log level to compare against the currently set log level.
237
+ */
238
+ shouldLog(level) {
239
+ return (typeof level === 'string' ? this.pinoLogger.levelVal : level) >= this.getLevel();
240
+ }
241
+ /**
242
+ * Gets an array of log line objects. Each element is an object that corresponds to a log line.
243
+ */
244
+ getBufferedRecords() {
245
+ if (!this.memoryLogger) {
246
+ throw new Error('getBufferedRecords is only supported when useMemoryLogging is true');
247
+ }
248
+ return this.memoryLogger?.loggedData ?? [];
249
+ }
250
+ /**
251
+ * Reads a text blob of all the log lines contained in memory or the log file.
252
+ */
253
+ readLogContentsAsText() {
254
+ if (this.memoryLogger) {
255
+ return this.memoryLogger.loggedData.reduce((accum, line) => {
256
+ accum += JSON.stringify(line) + os.EOL;
257
+ return accum;
258
+ }, '');
259
+ }
260
+ else {
261
+ this.pinoLogger.warn('readLogContentsAsText is not supported for file streams, only used when useMemoryLogging is true');
262
+ const content = '';
263
+ return content;
264
+ }
265
+ }
266
+ /**
267
+ * Create a child logger, typically to add a few log record fields. For convenience this object is returned.
268
+ *
269
+ * @param name The name of the child logger that is emitted w/ log line. Will be prefixed with the parent logger name and `:`
270
+ * @param fields Additional fields included in all log lines for the child logger.
271
+ */
272
+ child(name, fields = {}) {
273
+ const fullName = `${this.getName()}:${name}`;
274
+ const child = new Logger({ name: fullName, fields });
275
+ this.pinoLogger.trace(`Setup child '${fullName}' logger instance`);
276
+ return child;
277
+ }
278
+ /**
279
+ * Add a field to all log lines for this logger. For convenience `this` object is returned.
280
+ *
281
+ * @param name The name of the field to add.
282
+ * @param value The value of the field to be logged.
283
+ */
284
+ addField(name, value) {
285
+ this.pinoLogger.setBindings({ ...this.pinoLogger.bindings(), [name]: value });
286
+ return this;
287
+ }
288
+ /**
289
+ * Logs at `trace` level with filtering applied. For convenience `this` object is returned.
290
+ *
291
+ * @param args Any number of arguments to be logged.
292
+ */
293
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
294
+ trace(...args) {
295
+ this.pinoLogger.trace((0, unwrapArray_1.unwrapArray)(args));
296
+ return this;
297
+ }
298
+ /**
299
+ * Logs at `debug` level with filtering applied. For convenience `this` object is returned.
300
+ *
301
+ * @param args Any number of arguments to be logged.
302
+ */
303
+ debug(...args) {
304
+ this.pinoLogger.debug((0, unwrapArray_1.unwrapArray)(args));
305
+ return this;
306
+ }
307
+ /**
308
+ * Logs at `debug` level with filtering applied.
309
+ *
310
+ * @param cb A callback that returns on array objects to be logged.
311
+ */
312
+ // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
313
+ debugCallback(cb) { }
314
+ /**
315
+ * Logs at `info` level with filtering applied. For convenience `this` object is returned.
316
+ *
317
+ * @param args Any number of arguments to be logged.
318
+ */
319
+ info(...args) {
320
+ this.pinoLogger.info((0, unwrapArray_1.unwrapArray)(args));
321
+ return this;
322
+ }
323
+ /**
324
+ * Logs at `warn` level with filtering applied. For convenience `this` object is returned.
325
+ *
326
+ * @param args Any number of arguments to be logged.
327
+ */
328
+ warn(...args) {
329
+ this.pinoLogger.warn((0, unwrapArray_1.unwrapArray)(args));
330
+ return this;
331
+ }
332
+ /**
333
+ * Logs at `error` level with filtering applied. For convenience `this` object is returned.
334
+ *
335
+ * @param args Any number of arguments to be logged.
336
+ */
337
+ error(...args) {
338
+ this.pinoLogger.error((0, unwrapArray_1.unwrapArray)(args));
339
+ return this;
340
+ }
341
+ /**
342
+ * Logs at `fatal` level with filtering applied. For convenience `this` object is returned.
343
+ *
344
+ * @param args Any number of arguments to be logged.
345
+ */
346
+ fatal(...args) {
347
+ // always show fatal to stderr
348
+ // IMPORTANT:
349
+ // Do not use console.error() here, if fatal() is called from the uncaughtException handler, it
350
+ // will be re-thrown and caught again by the uncaughtException handler, causing an infinite loop.
351
+ console.log(...args); // eslint-disable-line no-console
352
+ this.pinoLogger.fatal((0, unwrapArray_1.unwrapArray)(args));
353
+ return this;
354
+ }
355
+ }
356
+ exports.Logger = Logger;
357
+ /**
358
+ * The name of the root sfdx `Logger`.
359
+ */
360
+ Logger.ROOT_NAME = 'sf';
361
+ /**
362
+ * The default `LoggerLevel` when constructing new `Logger` instances.
363
+ */
364
+ Logger.DEFAULT_LEVEL = LoggerLevel.WARN;
365
+ /**
366
+ * A list of all lower case `LoggerLevel` names.
367
+ *
368
+ * **See** {@link LoggerLevel}
369
+ */
370
+ Logger.LEVEL_NAMES = Object.values(LoggerLevel)
371
+ .filter(ts_types_1.isString)
372
+ .map((v) => v.toLowerCase());
373
+ /** return various streams that the logger could send data to, depending on the options and env */
374
+ const getWriteStream = (level = 'warn') => {
375
+ // used when debug mode, writes to stdout (colorized)
376
+ if (process.env.DEBUG) {
377
+ return {
378
+ target: 'pino-pretty',
379
+ options: { colorize: true },
380
+ };
381
+ }
382
+ // default: we're writing to a rotating file
383
+ const rotator = new Map([
384
+ ['1m', new Date().toISOString().split(':').slice(0, 2).join('-')],
385
+ ['1h', new Date().toISOString().split(':').slice(0, 1).join('-')],
386
+ ['1d', new Date().toISOString().split('T')[0]],
387
+ ]);
388
+ const logRotationPeriod = new kit_1.Env().getString('SF_LOG_ROTATION_PERIOD') ?? '1d';
389
+ return {
390
+ // write to a rotating file
391
+ target: 'pino/file',
392
+ options: {
393
+ destination: path.join(global_1.Global.SF_DIR, `sf-${rotator.get(logRotationPeriod) ?? rotator.get('1d')}.log`),
394
+ mkdir: true,
395
+ level,
396
+ },
397
+ };
398
+ };
399
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1,10 @@
1
+ /// <reference types="node" />
2
+ import { Writable } from 'stream';
3
+ /**
4
+ * Used by test setup to keep UT from writing to disk.
5
+ */
6
+ export declare class MemoryLogger extends Writable {
7
+ loggedData: Array<Record<string, unknown>>;
8
+ constructor();
9
+ _write(chunk: Record<string, unknown>, encoding: string, callback: (err?: Error) => void): void;
10
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MemoryLogger = void 0;
4
+ /*
5
+ * Copyright (c) 2023, salesforce.com, inc.
6
+ * All rights reserved.
7
+ * Licensed under the BSD 3-Clause license.
8
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
+ */
10
+ const stream_1 = require("stream");
11
+ const unwrapArray_1 = require("../util/unwrapArray");
12
+ const filters_1 = require("./filters");
13
+ /**
14
+ * Used by test setup to keep UT from writing to disk.
15
+ */
16
+ class MemoryLogger extends stream_1.Writable {
17
+ constructor() {
18
+ super({ objectMode: true });
19
+ this.loggedData = [];
20
+ }
21
+ _write(chunk, encoding, callback) {
22
+ const filteredChunk = (0, unwrapArray_1.unwrapArray)((0, filters_1.filterSecrets)([chunk]));
23
+ this.loggedData.push(typeof filteredChunk === 'string'
24
+ ? JSON.parse(filteredChunk)
25
+ : filteredChunk);
26
+ callback();
27
+ }
28
+ }
29
+ exports.MemoryLogger = MemoryLogger;
30
+ //# sourceMappingURL=memoryLogger.js.map
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" />
2
+ import { Transform } from 'stream';
3
+ export default function (): Transform;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ * Copyright (c) 2023, salesforce.com, inc.
5
+ * All rights reserved.
6
+ * Licensed under the BSD 3-Clause license.
7
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
8
+ */
9
+ const stream_1 = require("stream");
10
+ const unwrapArray_1 = require("../util/unwrapArray");
11
+ const filters_1 = require("./filters");
12
+ // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment
13
+ const build = require('pino-abstract-transport');
14
+ function default_1() {
15
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
16
+ return build(
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ (source) => {
19
+ const myTransportStream = new stream_1.Transform({
20
+ objectMode: true,
21
+ transform(chunk, enc, cb) {
22
+ if (debugAllows(chunk)) {
23
+ // uses the original logger's filters.
24
+ const filteredChunk = (0, unwrapArray_1.unwrapArray)((0, filters_1.filterSecrets)([chunk]));
25
+ const stringified = JSON.stringify(filteredChunk);
26
+ this.push(stringified.concat('\n'));
27
+ }
28
+ cb();
29
+ },
30
+ });
31
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
32
+ (0, stream_1.pipeline)(source, myTransportStream, () => { });
33
+ return myTransportStream;
34
+ }, {
35
+ // This is needed to be able to pipeline transports.
36
+ enablePipelining: true,
37
+ });
38
+ }
39
+ exports.default = default_1;
40
+ /** if the DEBUG= is set, see if that matches the logger name. If not, we don't want to keep going */
41
+ const debugAllows = (chunk) => {
42
+ if (!process.env.DEBUG || process.env.DEBUG === '*')
43
+ return true;
44
+ if (typeof chunk.name !== 'string')
45
+ return true;
46
+ // turn wildcard patterns into regexes
47
+ const regexFromDebug = new RegExp(process.env.DEBUG.replace(/\*/g, '.*'));
48
+ if (!regexFromDebug.test(chunk.name)) {
49
+ // console.log(`no match : ${chunk.name} for ${process.env.DEBUG}`);
50
+ return false;
51
+ }
52
+ else {
53
+ // console.log(`match : ${chunk.name} for ${process.env.DEBUG}`);
54
+ return true;
55
+ }
56
+ };
57
+ //# sourceMappingURL=transformStream.js.map
@@ -19,7 +19,7 @@ const transport_1 = require("jsforce/lib/transport");
19
19
  const jwt = require("jsonwebtoken");
20
20
  const config_1 = require("../config/config");
21
21
  const configAggregator_1 = require("../config/configAggregator");
22
- const logger_1 = require("../logger");
22
+ const logger_1 = require("../logger/logger");
23
23
  const sfError_1 = require("../sfError");
24
24
  const sfdc_1 = require("../util/sfdc");
25
25
  const stateAggregator_1 = require("../stateAggregator");
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.AuthRemover = void 0;
10
10
  const kit_1 = require("@salesforce/kit");
11
11
  const configAggregator_1 = require("../config/configAggregator");
12
- const logger_1 = require("../logger");
12
+ const logger_1 = require("../logger/logger");
13
13
  const messages_1 = require("../messages");
14
14
  const stateAggregator_1 = require("../stateAggregator");
15
15
  const orgConfigProperties_1 = require("./orgConfigProperties");
@@ -15,7 +15,7 @@ const jsforce_1 = require("jsforce");
15
15
  const tooling_1 = require("jsforce/lib/api/tooling");
16
16
  const myDomainResolver_1 = require("../status/myDomainResolver");
17
17
  const configAggregator_1 = require("../config/configAggregator");
18
- const logger_1 = require("../logger");
18
+ const logger_1 = require("../logger/logger");
19
19
  const sfError_1 = require("../sfError");
20
20
  const sfdc_1 = require("../util/sfdc");
21
21
  const messages_1 = require("../messages");
@@ -149,7 +149,7 @@ class Connection extends jsforce_1.Connection {
149
149
  ...exports.SFDX_HTTP_HEADERS,
150
150
  ...lowercasedHeaders,
151
151
  };
152
- this.logger.debug(`request: ${JSON.stringify(httpRequest)}`);
152
+ this.logger.getRawLogger().debug(httpRequest, 'request');
153
153
  return super.request(httpRequest, options);
154
154
  }
155
155
  /**