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

@nexssp/logdebug

v1.0.20

Published

Just log/debug for not only the Nexss Programmer..

Downloads

268

Readme

@nexssp/logdebug

15.01.2022 Upgrade - Now works also with import as module.

News

  • New 1.0.17: tracking functions. --debug:all or --debug:tracker more below

More

Note: 1.0.15 Now by default all logs and debug funcs goes to stdout - except error one. To move all of them to stderr: --output:stderr

Note: 1.0.12+ Now header function is size of terminal window.

Note: 1.0.11+ See new time functions below ..

Easy loging/debuging. Going to stderr if --debug. You can change from stderr to stdout easy by another option --debug:stdout. You can disable logs just by adding --quiet. Maybe you need just debug information, combine it with --quiet --debug.

Debug and Log functions and colors

Nexss Log and Debug functions

Parameters

This library is designed just to use cli process.argv directly.

  • yourprogram.js --debug # will display debugging information, without it won't.
  • yourprogram.js --debug:stdout # will pipe to stdout.
  • yourprogram.js --quiet # will hide logs information

Examples

note: below must be run with --debug or --debug:stdio . if you add --quiet, logs will not be displayed.

const log = require('@nexssp/log')
const { bold } = require('@nexssp/ansi')
// You can display debug infor by --debug or --debug:stdout
log.dy('\t Debug yellow: ' + bold('log.dy'))
log.dr('\t Debug red: ' + bold('log.dr'))
log.dg('\t Debug green: ' + bold('log.dg'))
log.di('\t Debug bold: ' + bold('log.di'))
log.db('\t Debug blue: ' + bold('log.db'))
log.du('\t Debug underscore: ' + bold('log.du'))

// You can bellow hide by --quiet
log.warn('\t Warning message ' + bold('log.warn'))
log.error('\t error message ' + bold('log.error'))
log.info('\t info message ' + bold('log.info'))
log.success('sucess message ' + bold('log.success'))
log.ok('\t ok message ' + bold('log.ok'))
log.trace('\t trace message ' + bold('log.trace'))

Time options (1.0.11+)

--debug:ms

displays time from the begining.

image

--debug:diff

Displays difference between each log.

image

Usage of tracker

External Usage

const o = {
  run, // tracker will be only added to the functions
  start,
  var1, //Will not be added, only functions
}
const { applyTracker } = require('@nexssp/logdebug/tracker')
applyTracker(o, null)

Composite

const { functionTracker } = require('../tracker')
function myComposite(a, b, { option1, option2 } = {}) {
  const _a = a
  const _b = b

  const trackFunction = functionTracker('mytitle')

  let myfunc2 = (param2) => {
    console.log(`${_b}`, param2)
  }

  let myfunc1 = (param1) => {
    console.log(`${_a}: ${param1}`)
    myfunc2(`${_a}: ${param1}`, 'works!')
  }

  myfunc1 = trackFunction(myfunc1)
  myfunc2 = trackFunction(myfunc2)

  let o = {
    myfunc1,
    myfunc2,
  }
  // applyTracker(o)

  return o
}

const compo = myComposite(1, 'string')
compo.myfunc1(1, 2, 3)
compo.myfunc2(1, 2, 3)