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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ms-iso-logger

v0.1.3

Published

Isomorphic logger

Downloads

12

Readme

ms-iso-logger

Isomorphic logger that works in client and server scope.

Install

yarn add ms-iso-logger

How it works

This package utilizes a webpack feature which looks at the browser field in package.json and uses that when bundling. When running on server side, node.js require looks at the main field, which points to another file. That way the interface looks the same but uses two different pieces of code behind the scenes. Check index-server.js and index-client.js for details.

Usage

To access the Logger, simply import it from ms-iso-logger and use it.

import { createLogger } from 'ms-iso-logger';

// create Logger and set context of logging instance (defaults to empty string)
const logger = createLogger('MyContext');

// log at different levels
logger.log('This is a message with level=INFO');
logger.debug('This is a message with level=DEBUG');

// change context of logging instance
logger.setContext('MyOtherComponent');

// log message with additional fields
logger.log({ message: 'This is a message', moreData: 'additional info' });

API

The module returns a single factory method that can be called to create a new Logger instance for the current environment. The Logger offers a set of public methods. NOTE: Due to the isomorphic nature the code behind the scenes still uses CJS instead of ES6 modules, so it is not possible to use named imports to e.g. import the Logger directly.

createLogger([contextId:string]):Logger

Factory method that creates a new Logger instance.

Logger.setContext(contextId:string)

Set logging context for this single Logger instance using the contextId parameter. This is added to the log output and should be used to identify the log origin. The reporter argument my be used to set a different reporter. This defaults to

Logger.info(message:any)

Log a message with level INFO. Message can be any primitive value or an object with additional fields which get passed as payload.

Logger.log(message:any)

Alias for Logger.info to comply with window.console naming.

Logger.debug(message:any)

Log a message with level DEBUG.

Logger.warn(message:any)

Log a message with level WARN.

Logger.error(message:any)

Log a message with level ERROR.