How to use raptor-logging - 10 common examples

To help you get started, we’ve selected a few raptor-logging 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 lasso-js / lasso / lib / async-page-bundles-builder.js View on Github external
var LoaderMetadata = require('./LoaderMetadata');
var dependencyWalker = require('./dependency-walker');
var raptorPromises = require('raptor-promises');
var DependencyTree = require('./DependencyTree');
var logger = require('raptor-logging').logger(module);

function buildAsyncPageBundles(pageBundleName, asyncGroups, bundleMappings, pageBundles, context) {
    
    var asyncPackageNames = Object.keys(asyncGroups);
    var loaderMeta = new LoaderMetadata(asyncPackageNames);
    var tree = logger.isInfoEnabled() ? new DependencyTree() : null;

    function handleAsyncGroup(asyncName, asyncDependencies) {
        return dependencyWalker.walk({
            dependencies: asyncDependencies,
            enabledExtensions: context.enabledExtensions,
            context: context,
            shouldSkipDependency: function(dependency) {
                if (!dependency.isPackageDependency() && !dependency.read) {
                    // ignore non-readable dependencies during bundling phase
                    return true;
github lasso-js / lasso / src / page-bundles-builder.js View on Github external
var PageBundles = require('./PageBundles');
var dependencyWalker = require('./dependency-walker');
var assert = require('assert');
var LassoManifest = require('./LassoManifest');
var LoaderMetadata = require('./LoaderMetadata');
var DependencyTree = require('./DependencyTree');
var logger = require('raptor-logging').logger(module);
var bundlingStrategies = require('./bundling-strategies');

async function build (options, config, bundleMappings, lassoContext) {
    // TODO: Change to fully use async/await
    assert.ok(options, '"options" is required');
    assert.ok(config, '"config" is required');
    assert.ok(bundleMappings, '"bundleMappings" is required');
    assert.ok(lassoContext, '"lassoContext" is required');

    var pageName = options.name || options.pageName;
    var lassoManifest = options.lassoManifest;
    var flags = lassoContext.flags;

    assert.ok(pageName, 'page name is required');
    assert.ok(typeof pageName === 'string', 'page name should be a string');
    assert.ok(lassoManifest, '"lassoManifest" is required');
github lasso-js / lasso / src / dependencies / DependencyRegistry.js View on Github external
var nodePath = require('path');
var extend = require('raptor-util').extend;
var inherit = require('raptor-util').inherit;
var Dependency = require('./Dependency');
var CONTENT_TYPE_CSS = require('../content-types').CSS;
var CONTENT_TYPE_JS = require('../content-types').JS;
var ok = require('assert').ok;
var typePathRegExp = /^([A-Za-z0-9_\-]{2,})\s*:\s*(.+)$/; // Hack: {2,} is used because Windows file system paths start with "c:\"
var readStream = require('../util').readStream;
var RequireHandler = require('./RequireHandler');
var equal = require('assert').equal;
var globNormalizer = require('./glob').normalizer;
var dependencyResource = require('./dependency-resource');
var logger = require('raptor-logging').logger(module);
var slice = Array.prototype.slice;

function createDefaultNormalizer(registry) {
    function parsePath(path) {
        var typePathMatches = typePathRegExp.exec(path);
        if (typePathMatches) {
            return {
                type: typePathMatches[1],
                path: typePathMatches[2]
            };
        } else {
            var type = registry.typeForPath(path);

            if (!type) {
                type = 'package';
            }
github marko-js / marko / test / taglib-lookup-tests.js View on Github external
'use strict';
var chai = require('chai');
chai.Assertion.includeStack = true;
require('chai').should();
var expect = require('chai').expect;
var nodePath = require('path');
var fs = require('fs');
var logger = require('raptor-logging').logger(module);

describe('raptor-templates/taglib-lookup' , function() {

    beforeEach(function(done) {
        for (var k in require.cache) {
            if (require.cache.hasOwnProperty(k)) {
                delete require.cache[k];
            }
        }

        require('raptor-logging').configureLoggers({
            'raptor-templates': 'INFO'
        });

        done();
    });
github lasso-js / lasso / src / writers / file-writer.js View on Github external
require('raptor-polyfill/string/endsWith');
require('raptor-polyfill/string/startsWith');

const MAX_FILE_LENGTH = 255;

const promisify = require('pify');
var util = require('../util');
var nodePath = require('path');
var fs = require('fs');
var ok = require('assert').ok;
var logger = require('raptor-logging').logger(module);
var mkdirp = promisify(require('mkdirp'));
var crypto = require('crypto');
var raptorAsync = require('raptor-async');
const Duplex = require('stream').Duplex;
const hashUtil = require('../util/hash');

function filePathToUrlWindows(path) {
    return path.replace(/[\\]/g, '/');
}

function filePathToUrlUnix(path) {
    return path;
}

function enforceFileLengthLimits(path) {
    return path.split(nodePath.sep).map(part => {
github lasso-js / lasso / lib / PageOptimizer.js View on Github external
var nodePath = require('path');
var OptimizerCache = require('./OptimizerCache');
var OptimizedPage = require('./OptimizedPage');
var OptimizerContext = require('./OptimizerContext');
var SlotTracker = require('./SlotTracker');
var escapeXmlAttr = require('raptor-util/escapeXml').attr;
var logger = require('raptor-logging').logger(module);
var EventEmitter = require('events').EventEmitter;
var mime = require('mime');
var raptorUtil = require('raptor-util');
var pageBundlesBuilder = require('./page-bundles-builder');
var BundleMappings = require('./BundleMappings');
var manifestLoader = require('./manifest-loader');
var OptimizerManifest = require('./OptimizerManifest');
var flags = require('./flags');
var dependencies = require('./dependencies');
var fs = require('fs');
var commaSeparatedRegExp = /\s*,\s*/;
var ok = require('assert').ok;
var bundleBuilder = require('./bundle-builder');
var isAbsolute = require('./path').isAbsolute;
var createWriter = require('./writers').createWriter;
var raptorModulesUtil = require('raptor-modules/util');
github lasso-js / lasso / src / Lasso.js View on Github external
const promisify = require('pify');
const assert = require('assert');
var nodePath = require('path');
var LassoCache = require('./LassoCache');
var LassoPageResult = require('./LassoPageResult');
var LassoContext = require('./LassoContext');
var SlotTracker = require('./SlotTracker');
var logger = require('raptor-logging').logger(module);
var EventEmitter = require('events').EventEmitter;
var mime = require('mime');
var raptorUtil = require('raptor-util');
var pageBundlesBuilder = require('./page-bundles-builder');
var BundleMappings = require('./BundleMappings');
var manifestLoader = require('./manifest-loader');
var LassoManifest = require('./LassoManifest');
var flags = require('./flags');
var dependencies = require('./dependencies');
var fs = require('fs');
var commaSeparatedRegExp = /\s*,\s*/;
var ok = require('assert').ok;
var bundleBuilder = require('./bundle-builder');
var isAbsolute = require('./path').isAbsolute;
var createWriter = require('./writers').createWriter;
var perfLogger = require('raptor-logging').logger('lasso/perf');
github marko-js / marko-widgets / lib / init-widgets-browser.js View on Github external
* you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

require('raptor-polyfill/array/forEach');
require('raptor-polyfill/string/endsWith');

var logger = require('raptor-logging').logger(module);
var raptorPubsub = require('raptor-pubsub');
var ready = require('raptor-dom').ready;
var _addEventListener = require('./addEventListener');
var registry = require('./registry');
var warp10Finalize = require('warp10/finalize');
var eventDelegation = require('./event-delegation');

function invokeWidgetEventHandler(widget, targetMethodName, args) {
    var method = widget[targetMethodName];
    if (!method) {
        throw new Error('Widget ' + widget.id + ' does not have method named "' + targetMethodName + '"');
    }

    method.apply(widget, args);
}
github lasso-js / lasso / taglib / page-tag.js View on Github external
var getLassoRenderContext = require('./getLassoRenderContext');
var logger = require('raptor-logging').logger(module);
var nodePath = require('path');
var fs = require('fs');
var AsyncValue = require('raptor-async/AsyncValue');
var extend = require('raptor-util/extend');

var util = require('./util');

module.exports = function render(input, out) {
    var lassoRenderContext = getLassoRenderContext(out);
    var theLasso = lassoRenderContext.lasso;
    if (input.lasso) {
        theLasso = lassoRenderContext.lasso = input.lasso;
    }

    var pageName = input.name || input.pageName;
    var cacheKey = input.cacheKey;
github lasso-js / lasso / src / LassoManifest.js View on Github external
var extend = require('raptor-util').extend;
var DependencyList = require('./DependencyList');
var ok = require('assert').ok;

var nodePath = require('path');
var FlagSet = require('./FlagSet');
var nextId = 0;

var condition = require('./condition');

var lassoResolveFrom = require('lasso-resolve-from');

var logger = require('raptor-logging').logger(module);

function resolveBrowserPath(dir, path) {
    var resolved;

    if (path.charAt(0) === '.') {
        resolved = lassoResolveFrom(dir, path);
    } else {
        resolved = lassoResolveFrom(dir, './' + path);
        if (!resolved) {
            resolved = lassoResolveFrom(dir, path);
        }
    }

    return resolved ? resolved.path : undefined;
}

raptor-logging

Module to support the optimized delivery of web application resources

Apache-2.0
Latest version published 7 years ago

Package Health Score

48 / 100
Full package analysis

Popular raptor-logging functions

Similar packages