How to use @ui5/logger - 10 common examples

To help you get started, we’ve selected a few @ui5/logger 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 SAP / ui5-builder / lib / lbt / analyzer / SmartTemplateAnalyzer.js View on Github external
*                 with a defaultValue of type string
 * The default value of the property represents the template view of the template component.
 * The manifest of the template app in theory could specify an alternative template in
 * component.settings.templateName,
 *
 * This class can handle multiple concurrent analysis calls, it has no instance state other than the pool
 * (which is readonly).
 */
"use strict";

const ModuleName = require("../utils/ModuleName");
const SapUiDefine = require("../calls/SapUiDefine");
const esprima = require("esprima");
const {Syntax} = esprima;
const {getValue, isMethodCall, isString} = require("../utils/ASTUtils");
const log = require("@ui5/logger").getLogger("lbt:analyzer:SmartTemplateAnalyzer");

// ---------------------------------------------------------------------------------------------------------

const CALL_DEFINE = ["define"];
const CALL_SAP_UI_DEFINE = ["sap", "ui", "define"];

/**
 * Analyzes the manifest for a Smart Template App (next to its Component.js) to find more dependencies.
 * @private
 */
class TemplateComponentAnalyzer {
	constructor(pool) {
		this._pool = pool;
	}

	async analyze(resource, info) {
github SAP / ui5-builder / lib / lbt / analyzer / JSModuleAnalyzer.js View on Github external
"use strict";

const esprima = require("esprima");
const {Syntax} = esprima;
const escope = require("escope");
const ModuleName = require("../utils/ModuleName");
const {Format: ModuleFormat} = require("../resources/ModuleInfo");
const UI5ClientConstants = require("../UI5ClientConstants");
const {findOwnProperty, getLocation, getPropertyKey, isMethodCall, isString} = require("../utils/ASTUtils");
const log = require("@ui5/logger").getLogger("lbt:analyzer:JSModuleAnalyzer");

// ------------------------------------------------------------------------------------------------------------------

const EnrichedVisitorKeys = (function() {
	const VisitorKeys = require("estraverse").VisitorKeys;

	function toBeDone() {
		return null;
	}

	/*
	 * The following object contains for each known estree node type
	 * a list of visitor keys that represent conditionally executed code branches.
	 * E.g. in an IfExpression, the 'test' is always executed, whereas 'consequent'
	 * and 'alternate' are only executed under certain conditions.
	 *
github SAP / ui5-builder / lib / builder / builder.js View on Github external
const {promisify} = require("util");
const rimraf = promisify(require("rimraf"));
const log = require("@ui5/logger").getGroupLogger("builder:builder");
const resourceFactory = require("@ui5/fs").resourceFactory;
const MemAdapter = require("@ui5/fs").adapters.Memory;
const typeRepository = require("../types/typeRepository");
const taskRepository = require("../tasks/taskRepository");
const BuildContext = require("./BuildContext");

const definedTasks = taskRepository.getAllTasks();

// Set of tasks for development
const devTasks = [
	"replaceCopyright",
	"replaceVersion",
	"buildThemes"
];

/**
github SAP / ui5-builder / test / lib / types / library / LibraryFormatter.js View on Github external
test.serial("getNamespace: from project root level library.js", async (t) => {
	const myProject = clone(libraryETree);

	const log = require("@ui5/logger");
	const loggerInstance = log.getLogger("types:library:LibraryFormatter");

	mock("@ui5/logger", {
		getLogger: () => loggerInstance
	});
	mock.reRequire("@ui5/logger");
	const loggerSpy = sinon.spy(loggerInstance, "verbose");

	const LibraryFormatter = mock.reRequire("../../../../lib/types/library/LibraryFormatter");

	const libraryFormatter = new LibraryFormatter({project: myProject});
	sinon.stub(libraryFormatter, "getManifest").resolves({});
	sinon.stub(libraryFormatter, "getDotLibrary").resolves({});
	sinon.stub(libraryFormatter, "getLibraryJsPath").resolves(path.normalize("/some/path/library.js"));
	sinon.stub(libraryFormatter, "getSourceBasePath").returns("/some/path/");
	const err = await t.throwsAsync(libraryFormatter.getNamespace());
github SAP / ui5-builder / test / lib / types / application / ApplicationBuilder.js View on Github external
const test = require("ava");
const chai = require("chai");
const path = require("path");
chai.use(require("chai-fs"));

const parentLogger = require("@ui5/logger").getGroupLogger("mygroup");

const ApplicationBuilder = require("../../../../lib/types/application/ApplicationBuilder");


function clone(o) {
	return JSON.parse(JSON.stringify(o));
}

const applicationBPath = path.join(__dirname, "..", "..", "..", "fixtures", "application.b");
const applicationBTree = {
	id: "application.b",
	version: "1.0.0",
	path: applicationBPath,
	dependencies: [],
	builder: {
		bundles: [{
github SAP / ui5-builder / test / lib / types / AbstractBuilder.js View on Github external
const test = require("ava");
const path = require("path");
const chai = require("chai");
chai.use(require("chai-fs"));
const sinon = require("sinon");

test.afterEach.always((t) => {
	sinon.restore();
});

const taskRepository = require("../../../lib/tasks/taskRepository");
const parentLogger = require("@ui5/logger").getGroupLogger("mygroup");

const AbstractBuilder = require("../../../lib/types/AbstractBuilder");


function clone(o) {
	return JSON.parse(JSON.stringify(o));
}

const applicationBPath = path.join(__dirname, "..", "..", "..", "fixtures", "application.b");
const applicationBTree = {
	id: "application.b",
	version: "1.0.0",
	path: applicationBPath,
	dependencies: [],
	builder: {},
	_level: 0,
github SAP / ui5-builder / lib / tasks / jsdoc / generateJsdoc.js View on Github external
const log = require("@ui5/logger").getLogger("builder:tasks:jsdoc:generateJsdoc");
const path = require("path");
const makeDir = require("make-dir");
const os = require("os");
const fs = require("graceful-fs");
const {promisify} = require("util");
const mkdtemp = promisify(fs.mkdtemp);
const rimraf = promisify(require("rimraf"));
const jsdocGenerator = require("../../processors/jsdoc/jsdocGenerator");
const {resourceFactory} = require("@ui5/fs");

/**
 * Task to execute a JSDoc build for UI5 projects
 *
 * @public
 * @alias module:@ui5/builder.tasks.generateJsdoc
 * @param {Object} parameters Parameters
github SAP / ui5-project / lib / translators / ui5Framework.js View on Github external
const pacote = require("pacote");
const fs = require("graceful-fs");
const {promisify} = require("util");
const stat = promisify(fs.stat);
const path = require("path");
const log = require("@ui5/logger").getLogger("normalizer:translators:ui5Framework");

const DIST_PKG_NAME = "@sap/ui5";

class FrameworkInstaller {
	constructor({dirPath, distVersion}) {
		if (!dirPath) {
			throw new Error(`installer: missing parameter "dirPath"`);
		}
		this._cwd = dirPath;

		const homedir = require("os").homedir();
		this._baseDir = path.join(homedir, ".ui5", "framework", "packages");
		this._cacheDir = path.join(homedir, ".ui5", "framework", "cacache");
		log.verbose(`Installing to: ${this._baseDir}`);

		this._distMetadataCache = null;
github SAP / ui5-webcomponents / packages / playground / lib / rewritebootstrap / index.js View on Github external
const path = require("path");
const replacestream = require("replacestream");
const log = require("@ui5/logger").getLogger("builder:customtask:RewriteBootstrap");

/**
 * Task to rewrite the bootstrap of the index.html
 *
 * @param {Object} parameters Parameters
 * @param {DuplexCollection} parameters.workspace DuplexCollection to read and write files
 * @param {AbstractReader} parameters.dependencies Reader or Collection to read dependency files
 * @param {Object} parameters.options Options
 * @param {string} parameters.options.projectName Project name
 * @param {string} [parameters.options.configuration] Task configuration if given in ui5.yaml
 * @returns {Promise} Promise resolving with undefined once data has been written
 */
module.exports = function({workspace, dependencies, options}) {
	return workspace.byGlob("/resources/playground/playground/index.html").then((resources) => {
        resources.forEach((resource) => {
            log.info("Replacing bootstrap in file " + resource.getPath());
github petermuessig / ui5-ecosystem-showcase / packages / ui5-task-transpile / lib / transpile.js View on Github external
const path = require("path");
const babel = require("@babel/core");
const log = require("@ui5/logger").getLogger("builder:customtask:transpile");

/**
 * Task to transpiles ES6 code into ES5 code.
 *
 * @param {Object} parameters Parameters
 * @param {DuplexCollection} parameters.workspace DuplexCollection to read and write files
 * @param {AbstractReader} parameters.dependencies Reader or Collection to read dependency files
 * @param {Object} parameters.options Options
 * @param {string} parameters.options.projectName Project name
 * @param {string} [parameters.options.configuration] Task configuration if given in ui5.yaml
 * @returns {Promise} Promise resolving with undefined once data has been written
 */
module.exports = function({workspace, dependencies, options}) {
	return workspace.byGlob("/**/*.js").then((resources) => {
        return Promise.all(resources.map((resource) => {
            if (!(options.configuration && options.configuration.excludePatterns || []).some(pattern => resource.getPath().includes(pattern))) {

@ui5/logger

UI5 Tooling - Internal Logger

Apache-2.0
Latest version published 5 months ago

Package Health Score

80 / 100
Full package analysis