npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

browserlog

v1.0.1

Published

Log utility for the browser

Downloads

1

Readme

browserlog

Browser console log utility.

Installation

npm install --save browserlog

The UMD build is in the dist directory.

Description

This logger is compatible with the known console api of chrome and firefox (and the others).

Supports timers, counters and groups. Also colors.

Twin brother for the server - serverlog:

https://www.npmjs.com/package/serverlog

https://github.com/newtoncodes/serverlog

Default logger

'use strict';

const Logger = require('../index');

// All options are optional!

let console = new Logger({
    style: ['blue'],         // List of all styles
    silent: false,           // Mute console output
    save: false,             // Save buffer for later use (send to server or something)
    saveLogger: false,       // Save current buffer to the main logger too
    bufferSize: 1024 * 1024, // Saved buffer size limit in bytes
    bufferDate: true,        // Display date in saved buffer
    bufferTime: false,       // Display time in saved buffer
    colors: true,            // Display colors and styles in console
    colorsFull: false,       // If label is set, only it will be colorful
                             // To make the whole log colorful, set this to true
    label: ''                // Label to be displayed next to each message
});

console.log('Test.');

####Available styles: black red green yellow blue magenta cyan white gray grey bgBlack bgRed bgGreen bgYellow bgBlue bgMagenta bgCyan bgWhite reset bold italic underline

Multiple streams

'use strict';

const Logger = require('../index');

let console = new Logger({
    label: 'APP'
});

console.add('stream1', {
    style: ['blue'],
    label: 'STREAM 1'
});

console.log('Test default.');
console.stream1.log('Test stream.');

Multiple streams singleton (IntelliSense support)

'use strict';

const Logger = require('../index');
const Stream = Logger.Stream;

let logger = new Logger();

logger.test1 = new Stream({
    style: ['blue'],
    label: 'TEST 1'
});

logger.test2 = new Stream({
    style: ['green'],
    label: 'TEST 2'
});

module.exports = logger;

// Now we import the logger from other files. It can replace console:
const console = require('./LocalLogger.js');

console.log('Test default.');
console.test1.log('Test stream 1.');
console.test2.log('Test stream 2.');

Examples

console.assert(false, 'Test assert #1');

console.log('MULTI\nLINE\nTEXT\nLOG');

console.group('Group test #1');
console.log('Normal log behavior:', 2, {test: 1});
console.table({test: 1}, 'Some compatibility fns.');
console.debug({test: 1}, 'Some alias fns.');

console.groupCollapsed('Group test #2');
console.assert(false, 'Test assert #2');
console.log('In-group log...', {test: 2});
console.dir({test: 2}, 'Inspect');

// console.clear();
console.groupEnd();

function someFunction() {
    console.trace();
    throw new Error('Test error');
}

function someFunction2() {
    someFunction();
}

try {
    someFunction();
} catch (e) {
    console.error(e);
    console.warn(e);
}

console.groupEnd();

console.info('Info', {test: 1});
console.debug('Debug', {test: 1});
console.error('Error', {test: 1});

console.count('Counter');
console.count('Counter');
console.count('Counter');

console.time('Timer #1');
console.timeEnd('Timer #1');

console.time('Timer #2');
setTimeout(() => {
    console.timeEnd('Timer #2');
    console.log(console.buffer);
}, 1000);