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

the-butcher

v1.0.6

Published

NodeJS package for logging

Readme

The Butcher

NodeJS package for logging.

Installation

Use the package manager npm to install the-butcher.

npm install the-butcher

Usage

var logger = require("the-butcher");

// Config example
const loggerConfig = {
	// Object for logger config to get event description and a field value
	entities: {
		// key - name of an entity, value (string) - main field of an entity (to get entity_name). Default - {}
		'file': {field: "name"},
		'user': {field: "email"},
		'place': {field: "id", requests: ['getinfo', 'add', 'find']}, /* entity can have a list of requests,
		so in case logger can't get entity from request url, it will get it from this array */
	}, /* also can be just object 'entity', then you will force the logger to describe the entity in log
	   example - entity: { type: 'Conference', field: 'id'} */
	writeToFile: true, // (boolean) true - write to log file, false - write to stdout. Default - false
	user: currentUser, // (string) currentUser name. Example - "ae.sypchenko". Default - " " or request.user.email if its not undefined
	file: "./src/debug.log", // (string) file you want your logs to be added to. If omitted, system will create 'debug.log' file in your root directory.
	requestDescription: 'Something happend' || { 'deletetopic': text: "Delete topic", field: "id"  } /* (string) || (object) used to describe event
	 in event_message. Result example -  'Something happend' || 'Delete topic 345'. Default - undefined */
	field: "name", /* (string) field to get event message if requestDescription is omitted. Default "name" */
};

// add to Express.js
app.all("*", (req, res, next) => {
	logger(req, res, loggerConfig);
	next();
});

// add to NestJS
app.use("*", (req, res, next) => {
	logger(req, res, loggerConfig);
	next();
});


// example for just one request

router.post('addcard', (req, res, next) => {
    const loggerConfig = {
		entity: { type: 'card', field: 'name'} // e.g let card = { name: 'New Card'}
		user: currentUser,
		requestDescription: 'User added a card';
};
	logger(req, res, loggerConfig);
})

Log Format

{
	"timestamp": "2020-07-30T06:57:35.629Z",
	"log_type": "audit",
	"client_ip": "1",
	"username": "ttonya",
	"entity_type": "card",
	"entity_name": "Some Card",
	"event_type": "create",
	"event_message": "Some card created",
	"event_success": "true"
}

{
	"timestamp": "2020-07-30T06:57:35.629Z",
	"log_type": "audit",
	"client_ip": "1",
	"username": "ttonya",
	"entity_type": "card",
	"entity_name": "New Card",
	"event_type": "create",
	"event_message": "User added a card - New Card",
	"event_success": "true"
}