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 🙏

© 2025 – Pkg Stats / Ryan Hefner

logsdx

v0.1.1

Published

log streaming with dx on the 🧠

Readme

LogsDX

A flexible log processing and visualization library that supports multiple output formats and, most importantly,

asci syntax highlighting, theming, and extendability for all!

LogsDX aims to provide the ability create use and extend asci themes that can be used in terminal and clients.

Why

After dealing with inferior logs in various clients—ci, ui cloud tools, etc, a way to have the same visual athstetic of logs in both the terminal and clients seemed necessary.

As of, 2025-04-13, these features are planned:

  • [x] basic theming and theme support for piping JSON logs in a terminal
  • [x] code functionality for non-specific logs in a terminal
  • [ ] full example and importability of non-specific logs in a terminal (in progress)
  • [x] code functionality for asci log theming in a react client
  • [ ] full example and importability of asci log theming in a react client (in progress)
  • [ ] more composable way to import and treeshake features
  • [ ] documented working demo displaying the ability to add/use/create custom themes
  • [ ] documented working demo displaying the ability to add/use/create custom parsers
  • [ ] documented workign demo displaying the ability to add/use/create custom clients
  • [ ] clearly documented schemas for theming and parsing
  • [ ] clearly documented way to create and use custom clients
  • [ ] improve ways to use build artifacts—only client, only cli, etc

Installation

npm install logsx

CLI Usage

LogsDX provides a powerful command-line interface for processing and formatting logs.

Basic Usage

# Process a log file
logsx input.log

# Process logs from stdin
cat input.log | logsx

# Save output to a file
logsx input.log --output formatted.log

Options

--quiet, -q           Suppress all output except errors
--debug, -d           Enable debug mode
--level, -l <level>   Minimum log level to display (default: "info")
--parser, -p <parser> Parser to use for log parsing (default: "default")
--rules, -r <file>    Path to custom rules file
--output, -o <file>   Path to output file
--list-parsers        List available parsers

Examples

List Available Parsers

logsx --list-parsers

Parse JSON Logs

# Parse a JSON log file
logsx input.json --parser=json

# Parse JSON logs from stdin
echo '{"level":"info","message":"Test message","timestamp":"2023-01-01T00:00:00.000Z"}' | logsx --parser=json

# Parse complex JSON logs
echo '{"level":"error","message":"Database connection failed","timestamp":"2023-01-01T00:00:00.000Z","service":"api","user_id":123,"error_code":500}' | logsx --parser=json

Parse with Custom Rules

# Parse logs with custom regex rules
logsx input.log --parser=regex --rules=rules.json

# Example rules.json:
[
  {
    "match": "\\[(.*?)\\]\\s+(.*)",
    "extract": {
      "level": "$1",
      "message": "$2"
    }
  }
]

Filter by Log Level

# Show only warnings and errors
logsx input.log --level=warn

# Show only errors
logsx input.log --level=error

Debug Mode

# Enable debug mode for verbose output
logsx input.log --debug

Client usage

LogDX aims to provide the ability create asci themes that can be used in clients.

React Component Usage

import { LogViewer } from "logsx";

function App() {
  return (
    <LogViewer
      log={logContent}
      enhancer={enhancer}
      showLineNumbers
      theme={{
        error: ["red"],
        warn: ["yellow"],
        info: ["blue"],
      }}
    />
  );
}

Plugins

Using Plugins

import { createLogEnhancer } from "logsx";
import { PrismPlugin } from "@logsx/prism";
import { ShikiPlugin } from "@logsx/shiki";

const enhancer = createLogEnhancer();
enhancer.use(new PrismPlugin({ theme: "github-dark" }));
enhancer.use(new ShikiPlugin({ theme: "github-dark" }));

Creating Plugins

import { LogEnhancerPlugin } from "logsx";

const MyPlugin: LogEnhancerPlugin = {
  name: "my-plugin",
  enhanceLine: (line, index) => `[${index}] ${line}`,
  parseLevel: (line) => {
    if (line.includes("ERROR")) return "error";
    if (line.includes("WARN")) return "warn";
    return "info";
  },
};

Clients

Using Clients

import { LogEnhancer } from "logsx";
import { InkClient } from "@logsx/ink";
import { ReactClient } from "@logsx/react";

const enhancer = new LogEnhancer({
  clients: [new InkClient(), new ReactClient()],
});

Creating Clients

import { LogClient } from "logsx";

const MyClient: LogClient = {
  name: "my-client",
  write: (line) => {
    // Custom output logic
    console.log(`[MyClient] ${line}`);
  },
};

Parsers

Using Parsers

import { LogEnhancer } from "logsx";
import { JSONParser } from "@logsx/json";
import { RegexParser } from "@logsx/regex";

const enhancer = new LogEnhancer({
  parsers: [new JSONParser(), new RegexParser()],
});

Creating Parsers

import { LogParser } from "logsx";

const MyParser: LogParser = {
  name: "my-parser",
  parse: (line) => {
    // Custom parsing logic
    const match = line.match(/\[(.*?)\]/);
    return match ? { level: match[1] } : {};
  },
};


Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Install dependencies (bun install)
  4. Run tests (bun test)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Development

# Install dependencies
bun install

# Using mise for development tasks
# brew install mise
mise run check      # Run all checks (tests, lint, format)
mise run pre-commit # Run pre-commit checks
mise run lint       # Run ESLint
mise run format     # Run Prettier
mise run test       # Run tests
mise run build      # Build the project