JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q35450F
  • License ISC

A minimal logger implementation for node, typescript, and the browser

Package Exports

  • loganite
  • loganite/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (loganite) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

new Logger( context, level )

This micro-package provides a minimalist logging solution with support for node, typescript, and the browser.

Install

npm i loganite

Usage

Basic

import { Logger } from 'loganite';

const log = new Logger("main", "debug");

log.fatal("Testing");
log.error("Testing");
log.warn("Testing");
log.normal("Testing");
log.info("Testing");
log.debug("Testing");
log.trace("Testing"); // would not log

Browser console control

window.localStorage.setItem("LOG_COLOR", "false"); // turn off coloring
window.localStorage.setItem("LOG_LEVEL", "debug"); // set default level to "debug"

Planned features

  • Avoid expensive arg computations
    • Short-circuit using logical operators
    • Callback function for args that only evaluate when a message will be logged