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

perf-async-logger

v1.2.2

Published

A simple node js library to log async function with error handling and performance tracking

Readme

Async Logger 📜

A simple Node.js library to log async functions with error handling and performance tracking.

🚀 Features

  • Automatic logging for async function calls
  • Error handling with logs
  • Execution time tracking
  • Easy to use decorator-based approach

📦 Installation

npm install perf-async-logger

🔧 How to Use

1️⃣ Import the Logger

import { logAsync, Logger, LogLevel } from "perf-async-logger";

2️⃣ Use the @logAsync Decorator

Apply @logAsync to your async functions:

import { logAsync } from "perf-async-logger";

class MyService { @logAsync async fetchData(value: string): Promise { return Received: ${value}; }

@logAsync
async fetchWithError(): Promise<void> {
    throw new Error("Intentional error");
}

}

const service = new MyService(); service.fetchData("test"); // Logs execution time and success service.fetchWithError(); // Logs error message

📜 Logger Output

The library logs start time, execution time, and errors:

✅ Successful function call

[INFO] 2025-02-21T15:28:37.986Z - Start fetchData with args: ["test"] [INFO] 2025-02-21T15:28:37.991Z - End fetchData with result: "Received: test" [INFO] 2025-02-21T15:28:37.996Z - fetchData executed in 5.679ms

❌ Error in function

[INFO] 2025-02-21T15:26:49.260Z - Start fetchWithError with args: [] [ERROR] 2025-02-21T15:26:49.265Z - fetchWithError executed in 5.052ms with error: Intentional error

⚙️ Custom Logging

You can manually log messages using the Logger class:

import { Logger, LogLevel } from "perf-async-logger";

Logger.log(LogLevel.INFO, "This is an info message"); Logger.log(LogLevel.ERROR, "Something went wrong!");

🛠 Configuration (Optional)

By default, logs are written to log.txt. To change this, set the LOG_FILE environment variable:

export LOG_FILE=custom-log.txt


📄 License

This project is licensed under the MIT License. 🤝 Contributing

Feel free to fork and submit PRs! 🚀


📬 Contact

Created by sawssen Fattahi https://github.com/sawsenFattahi


🆕 Updates:

Added a "How to Use" section with clear steps
Explained configuration (changing log file name)
More clarity on error logging and outputs

Let me know if you need any other changes! 🚀🔥