How to use the @salesforce/core.Logger.root function in @salesforce/core

To help you get started, we’ve selected a few @salesforce/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eltoroit / ETCopyData / src / @ELTOROIT / Util.ts View on Github external
msg += message;
			// tslint:disable-next-line:no-console
			console.log(msg);
		}

		// And entry to list
		this.entries.push({
			description: message,
			entryNumber: this.counter + (segmentNumber > 1 ? `.${segmentNumber}` : ""),
			level: LogLevel[level],
			lineNumber: lineNumber.padEnd(20, " "),
			timestamp,
		});

		// Add entry to SFDX logger
		Logger.root().then((logger: Logger) => {
			switch (level) {
				case LogLevel.TRACE:
					logger.trace("[" + lineNumber + "][" + timestamp + "]: " + message);
					break;
				case LogLevel.DEBUG:
					logger.trace("[" + lineNumber + "][" + timestamp + "]: " + message);
					break;
				case LogLevel.INFO:
					logger.info("[" + lineNumber + "][" + timestamp + "]: " + message);
					break;
				case LogLevel.WARN:
					logger.warn("[" + lineNumber + "][" + timestamp + "]: " + message);
					break;
				case LogLevel.ERROR:
					logger.error("[" + lineNumber + "][" + timestamp + "]: " + message);
					break;