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

loggasm

v1.1.4

Published

Welcome to **Logasm**, the logger that doesn’t care if your app is crashing — it’s here to entertain and roast you along the way. Think of it as the stand-up comedian of logging libraries. Sure, it’ll help you debug, but it might also hurt your feelings.

Downloads

813

Readme

Logasm - Logging That Gives You Goosebumps

Welcome to Logasm, the logger that doesn’t care if your app is crashing — it’s here to entertain and roast you along the way. Think of it as the stand-up comedian of logging libraries. Sure, it’ll help you debug, but it might also hurt your feelings. 🫢

Why Logasm? 🤔

Let’s face it: debugging is stressful. Logs are usually dull. Logasm makes sure your logs are as entertaining as they are useful. It's like having a comedian whispering jokes while you're fixing that "undefined is not a function" error.

With Logasm, you'll:

  • Logs that actually make you laugh while your code is on fire? 🔥
  • A logger that’s more sarcastic than your college roommate?😎
  • Debugging messages that make you question your life choices? ☠️

Logasm has you covered. If you can handle the sass, you’ll love it. (If you can’t… well, maybe stick to console.log 🥱.)

Features 🌟

  • OopsPrint: Print logs that might solve your problem or roast you for having it in the first place.
  • OopsWare: Express middleware that handles errors with a dash of humor and a side-eye.
  • ES Modules Only: because clearly, CommonJS is just a fancy term for "I don't know what I'm doing." 🧐

Installation 🚀

Don’t overthink it. Just install it.

npm install logasm

Usage 🛠️

Here’s how you can sprinkle some Logasm magic into your project:

Basic Logging

Start logging like a pro (or a clown, your choice):

import { oopsPrint } from 'logasm';

oopsPrint('The server is waking up. Please hold your applause!', { 
  details: { port: 3000, env: 'development' } 
});

Custom Heading for Logs: The oopsPrint now accepts a dynamic heading for logs (heading: 'YOUR_CUSTOM_HEADING').

oopsPrint('Server started successfully', { heading: 'SUCCESS' }); //Only use heading on development

Note: Headings are fun and all, but in production? They’re like adding glitter to a fire—unnecessary, messy, and bound to cause regret. Keep it clean, keep it simple—save the drama for development.

Express Middleware - Handle Errors Like a Boss

Plug in OopsWare and handle errors without breaking a sweat:

import { OopsWare } from 'logasm';
app.use(OopsWare(true)); // default is false for production keep it like that .
      or
const isDev = process.env.NODE_ENV === 'development'; 
app.use(OopsWare(isDev)); 

Example:

app.get("/error", (req, res, next) => {
  try {
    throw new Error("Something went wrong!");
  } catch (error) {
    next(error);
  }
});

FAQ

⚰️ Why does Logasm roast me when I mess up?

Because someone has to.

⚰️Can I use this at work?

Depends. Do you like your coworkers?

⚰️Is this the most useful logger out there?

No. But it’s definitely the most fun.

⚰️Does it solve all my problems?

Are you dumb...?

WARNING ⚠️

If you’re easily offended, Logasm might not be for you. It logs with a touch of humor and a pinch of shade. If you can’t handle a little tough love, go back to using console.log and let us know how that works out. 🫡

API 🔧

OopsPrint(message, options) Logs a message. May or may not be polite about it.

message: What you’re hoping will help (but probably won’t). options: Extra details that Logasm might ignore entirely. OopsWare(err, req, res, next) Middleware for Express to make sure your errors are logged, mocked, and then handled.

License 📜

MIT License.

Looking for Contributions!

I welcome contributions to make Loggasm even better. If you have ideas, bug fixes, or want to add a new feature, feel free to open an issue or submit a pull request. Let's make this library even more awesome, together! 💻✨