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

human-logs

v0.4.1

Published

Human friendly logs for your APIs & projects.

Downloads

560

Readme

human-logs

npm version npm downloads Github Actions

🛠 A tiny log library that allows you to take events, explanations and solutions and connect them like lego-pieces to create user-friendly logs.

Good log messages increases customer satisfaction, as they work as sort of a guide, helping the user achieve what they wanted to achieve. Good logs minimize the amount of support calls, improve customer satisfaction and trust in your product, ultimately being a win-win for both the creators of software and the users.

Inspired by Vercel's Error design framework, human-logs allows you to take events, explanations and solutions, and connect them like lego-pieces, to create user-friendly logs in a versatile manner.

Focus on understanding the errors.

Features

  • Create consistent, human-friendly logs throughout your application or library
  • Build versatile errors like lego-blocks
  • Support for parameters

💻 Example Usage

export const apiLogs = createHumanLogs({
	events: {
		project_create_failed: 'Cannot create your project',
		team_create_failed: 'Cannot create your team',
	},
	explanations: {
		api_unreachable: 'because the API cannot be reached.',
		team_exists: {
			template: 'because a team with ID "{teamId}" already exists.',
			params: {
				teamId: ''
			}
		}
	},
	solutions: {
		check_status_page: {
			template: 'You can check the status of our services on our status page.',
			params: {},
			actions: [
				{
					text: 'Go to status page',
					href: 'https://skosh.dev'
				}
			]
		}
	}
})

// You can now use `apiLogs` to create user-friendly error logs, by connecting events, explanations and solutions like lego-blocks.
const log = apiLogs({
	event: ['project_create_failed'],
	explanation: ['api_unreachable'],
	solution: ['check_status_page']
})

console.log(log.message)
// => Cannot create your project because the API cannot be reached. You can check the status of our services on our status page.

console.log(log.actions)
/* => [{
		text: 'Go to status page',
		href: 'https://status.foobar.inc'
	}]*/

console.log(log.toString())
// => Cannot create your project because the API cannot be reached. You can check the status of our services on our status page. Go to status page (https://status.foobar.inc)

// Example with parameters
const logWithParams = apiLogs({
	event: ['team_create_failed'],
	explanation: ['team_exists'],
	params: {
		teamId: 'winning-team'
	}
})
console.log(logWithParams.message)
// => Cannot create your team because a team with ID "winning-team" already exists.

💻 Development

  • Clone this repository
  • Enable Corepack using corepack enable (use npm i -g corepack for Node.js < 16.10)
  • Install dependencies using pnpm install
  • Run the tests using pnpm dev

License

Made with ❤️ in Helsinki

Published under MIT License.