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

b-logger

v0.0.14

Published

logger

Downloads

46

Readme

Build Status MIT license

Usage

const {debug,error,warn,info } = require("b-logger")("logger.tag")
debug("debug")
error("error")

debug,error,warn,info are logger functions. logger.tag is a name of the four functions.

//logger function
(message:string,...params:any[])=>void

Configure

b-logger read json and config log4js.

  • current working directory/logger.json
  • start up script's director/logger.json

Example:

{
  "level": "debug",
  "error": {
    "path": "./log/error.log",
    "fileNamePattern": "-dd"
  },
  "warn": {
    "path": "./log/warn.log",
    "fileNamePattern": "-dd"
  },
  "info": {
    "path": "./log/info.log",
    "fileNamePattern": "-dd"
  },
  "debug": {
    "path": "./log/debug.log",
    "fileNamePattern": "-dd"
  },
  "options":{
    "console":{
      "exclude":[
        ".*"
      ],
      "include":[
        "^debug"
      ]
    }
  }
  "options.dev":{

  }
}

pattern see here

options

exclude is an array of RegExp string that used to specify which loggers will be excluded (output nothing to console)

include is an array of regexp string also and it was used to specify which loggers will be included.

If no exclude and include fields ,all the log will be output. If a logger's name matchs exclude and include, it will be included

maxPathLength is a number to specify the max path length on the log header. -1 is infinite.

maxFuncNameLength is a number to specify the max function name on the log header. time is a time format ,such as YYYY-MM-DD hh:mm:ss

layout is a string to describe the log header's layout.

  • %t - time placeholder
  • %l - level placeholder
  • %n - name placeholder
  • %p - position-info placeholder

For example, [%t] [%n] [%p] will be process to generate [11:53] [test] [@anonymous -ogger/src/exp.ts:8:3]

options.dev options.dev has the same structure with option which used to overwrite option.console if NODE_ENV or B_LOGGER was set to dev