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

log-frmt

v1.0.3

Published

Format API log files

Readme

log-formatter

npm version
License: MIT

A powerful CLI tool to format and extract key information from API log files. Perfect for developers and DevOps engineers working with API logs.

Features

  • 🚀 Formats API log files with lightning speed
  • 🔍 Extracts key information: request, response, URLs, and timestamps
  • 📁 Processes single files or entire directories
  • 🛠️ Handles JSON, XML, and mixed content formats
  • 📊 Progress tracking with visual indicators
  • 🛡️ Robust error handling with detailed error codes

Installation

npm install -g log-formatter

Usage

Basic Commands

  • Format a single file:

    frmt log.txt
  • Format a file with absolute path:

    frmt -a /path/to/your/log.txt
  • Format all files in current directory:

    frmt -l .
  • Format all files in specific directory:

    frmt -l /path/to/logs/

Command Options

| Option | Description | | ---------------- | ---------------------------------------- | | [file] | Process a single file or directory | | -a, --absolute | Absolute path to a file or directory | | -l, --all | Process all files in specified directory | | --version | Show package version | | --help | Show help message |

How It Works

The formatter:

  1. Parses API log files

  2. Extracts these key fields:

    • leadId
    • requestUrl
    • request
    • requestTime
    • response
    • responseTime
  3. Formats JSON content for better readability

  4. Preserves XML content as-is

  5. Creates new files with _F suffix (e.g., log.txtlog_F.txt)

Error Codes

| Code | Description | Solution | | ----- | --------------------------------- | ------------------------- | | FL001 | No valid files found | Check directory/file path | | FL002 | File not found | Verify file exists | | FL003 | File processing error | Check file permissions | | FL101 | Invalid log format (missing JSON) | Verify log file content | | FL102 | Main JSON parsing error | Check JSON validity | | FL201 | Request/response parsing error | Inspect problematic field |

Examples

Before Formatting

// collection: third_party_api_log
{
  "_id": "5f9d9b3d7b8f9b0017b0b1a0",
  "policyTypeId": "1",
  "leadId": "68711864195688024da2d807",
  "apiName": "motor-quotes",
  "requestUrl": "https://example.com/api",
  "request": "{\"key\":\"value\"}",
  "requestTime": "2025-07-11T19:28:07.183+05:30",
  "response": "<xml>...</xml>",
  "responseTime": "2025-07-11T19:28:26.977+05:30",
  "__v": 0
}

After Formatting

{
  "leadId": "68711864195688024da2d807",
  "requestUrl": "https://example.com/api",
  "request": {
    "key": "value"
  },
  "requestTime": "2025-07-11T19:28:07.183+05:30",
  "response": "<xml>...</xml>",
  "responseTime": "2025-07-11T19:28:26.977+05:30"
}

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository

  2. Create a new branch

    git checkout -b feature/your-feature
  3. Commit your changes

    git commit -am "Add some feature"
  4. Push to the branch

    git push origin feature/your-feature
  5. Create a Pull Request

License

This project is licensed under the MIT License. See the LICENSE file for details.


Created with ❤️ by Ankur Report Issues | View on GitHub