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

pylog

v1.0.9

Published

Front End Logger Abstraction Library

Readme

FrontEnd Logging Abstraction

This is a utility package for implementing logging abstraction and is highly customizable. It contains 3 entities mainly Logger, Formatter and Handler.

Logger

This is the main entity that is responsible for all the logging. It uses Handler to log all the details.

Logger can be considered as a skeleton to proxy to log records to underlying entities.

Handler

Handlers are responsible for forwarding the log records to the expected destinations.

handlers can be anything from a Basic Console Handler to a handler forwarding log records to third party applications like Sumologic,ElasticCache,Database, FileSystem etc.

New handlers can be easily created by extending BaseHandler abstract class and overriding hooks.

Formatter

Formatter is an entity that is responsible for formatting the log records.

Formatter can format log records to simple text or JSON or anything you want.

These are again higly customizable.

Creating simple logger

Creating basic logger is very easy. We create formatter and handler instances and register them to logger instances.

import { Logger, formatters, handlers, Levels, utils } from "gs_logger"

const f = new formatters.BasicFormatter();
const h = new handlers.ConsoleHandler();
h.setFormatter(f);
const l = new Logger();
l.addHandler(h);
l.info("wow this works")

Above will log below record to console.

[INFO] wow this works

Basic logger can also be created using utils get_basic_logger method.

import { utils } from "gs_logger"

const l = utils.get_basic_logger();
l.info("wow this works")

This would create a basic console logger instance.

Creating Custom Logger

You can also customize logger instance creation using utility method get_custom_logger.

import { Logger, formatters, handlers, Levels, utils } from "gs_logger"

const f = new formatters.JSONFormatter();
const l = utils.get_custom_logger({
    formatter: f,
    handlers: [new handlers.ConsoleHandler()]
})
l.info("${name} this works", { name: "sam" })

try {
    throw new Error("Couldn't create logger")
} catch (error) {
    l.error(error)
}

This will create a custom logger instance with provided formatters and handlers. This also has option for passing level to set the log level.

Loading into html

There are two distributions released with pylog for IIFE and System JS that can be used with browser.

For using IIFE version, you may use it as below.

<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.27.2/axios.min.js"      crossorigin="anonymous"
referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js" crossorigin="anonymous"
referrerpolicy="no-referrer"></script>
<script src="pylog.iife.js"></script>
<script>const l = pylog.utils.get_basic_logger(); l.info("this works");</script>

For using SystemJS, you may want to use it as below:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/system.js" crossorigin="anonymous"
        referrerpolicy="no-referrer"></script>
<script type="systemjs-importmap">
    {
      "imports": {
        "moment": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js",
        "axios": "https://cdnjs.cloudflare.com/ajax/libs/axios/0.27.2/axios.min.js"
      }
    }
</script>
<script>System.import('./pylog.system.js').then(w => { console.log(w) });</script>