How to use the @ui5/logger.getLogger function in @ui5/logger

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 / 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 / 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))) {
github SAP / ui5-builder / lib / types / library / LibraryFormatter.js View on Github external
const log = require("@ui5/logger").getLogger("types:library:LibraryFormatter");
const path = require("path");
const fs = require("graceful-fs");
const {promisify} = require("util");
const readFile = promisify(fs.readFile);
const glob = require("globby");
const slash = require("slash");
const AbstractUi5Formatter = require("../AbstractUi5Formatter");


class LibraryFormatter extends AbstractUi5Formatter {
	/**
	 * Formats and validates the project
  	 *
	 * @returns {Promise}
	 */
	async format() {
github SAP / ui5-builder / lib / processors / themeBuilder.js View on Github external
const log = require("@ui5/logger").getLogger("builder:processors:themeBuilder");
const path = require("path");
const less = require("less-openui5");
const Resource = require("@ui5/fs").Resource;

const libraryMatchPattern = /^\/resources\/(.*)\/themes\/[^/]*\/library\.source\.less$/i;

/**
 * Builds a library theme
 *
 * @public
 * @memberof module:@ui5/builder.processors
 */
class ThemeBuilder {
	/**
	 * Constructor
	 *
github SAP / ui5-project / lib / projectPreprocessor.js View on Github external
const log = require("@ui5/logger").getLogger("normalizer:projectPreprocessor");
const fs = require("graceful-fs");
const path = require("path");
const {promisify} = require("util");
const readFile = promisify(fs.readFile);
const parseYaml = require("js-yaml").safeLoadAll;
const typeRepository = require("@ui5/builder").types.typeRepository;

class ProjectPreprocessor {
	constructor() {
		this.processedProjects = {};
		this.configShims = {};
		this.collections = {};
		this.appliedExtensions = {};
	}

	/*

@ui5/logger

UI5 Tooling - Internal Logger

Apache-2.0
Latest version published 4 months ago

Package Health Score

80 / 100
Full package analysis