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

html-logger

v1.4.0

Published

Simple html logger that appends into the page's body

Downloads

418

Readme

html-logger

simple html logger that appends it self to a page's body. based on the idea of http://www.songho.ca/misc/logger/files/Logger.js. written with ES6 syntax and transpiled with babel.io. feel free to hack and improve this.

demo

this logger is usefull when you have to debug on enviroments without access to the web-tools

current release: v1.1.3

install

npm

npm install html-logger
bower i html-logger

usage

html

add the script refence to dist/html-logger.bundle.js and initialize the logger

let logger = new HtmlLogger({name: "Test App"})
logger.init(true) // appends the logger
logger.debug({object: 1})
console.log({obj: ""}) // works with `captureNative` option

node | electron.io

// preload.js
import HtmlLogger from 'html-logger'
window.onload = () => {
    const logger = new HtmlLogger({name: "Test App"})
    logger.init(true)
    global.logger = logger
}

the logger toggles by default with shift+t keys combination

features

  • Log levels: info, success, warning, error, debug
  • Prints strings, objects and functions
  • Log all the arguments. Example: logger.info("test", { test: true}, "test2")
  • Captures window.console messages.

api

options

  • name: [string] the app name to show on the logger title. default Html Logger
  • enabled: [boolean] indicates if logger is enabled. logger prints only when it is enabled. default true
  • height: [number] indicates the logger container height. default 420
  • animationDuration: [number] the animation durations in milli seconds. default 200
  • maxLogCount: [number] the maximun number of lines to persist in the logger view. default 40.
  • shortcuts: [object] ctrl/command shortcuts
    • toggle: [char] toggles the logger. default shift+T
    • clean: [char] clean the logger. default shift+L
  • captureNative: [boolean] captures window.console messages. default false
console.log -> logger.debug
console.warn -> logger.warning
console.error -> logger.error
console.info -> logger.info
  • bufferSize: [number] set the buffer length. default 100. This is usefull to get the messages lines and save them to a file.
  • argumentsSeparator: [string] separator for the messages. default " "
  • level: [number] logging level. default 1. Levels: 0 | DEBUG, 1 | INFO, 2 | SUCCESS, 3 | WARNING, 4 | FATAL
  • utcTime: [boolean] the time stamp uses UTC time. default true
  • loggingFormat: [string] format the log message using the keywords [TIME], [LEVEL] and [MESSAGE]. default "[TIME] [LEVEL] [MESSAGE]". e.g
logger.debug("test")
// result: 18:00:00 DEBUG test"

methods

  • constructor([object] options): initialize the object.
  • init(Boolean show = false): initializes the logger. throws exception if document node == null
  • show(), hide(), toggle(): display methods
  • print([object] msg, [string - a valid hex color] hexColor, [string] level): append message lines into the logger.
  • setLevel([number] level): set ogging level
  • setEnableCaptureNativeLog(Boolean enabled): capture the window.console messages
  • getBuffer(): returns and clean the buffer

develop

install dependencies

npm install -g gulp
npm install

run gulp

run default tasks

gulp

run develop task (watch files)

gulp develop

testing

use jasmine. see spec/html-logger_spec.js

npm test