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

@flowlogs/js

v0.1.9

Published

Simple class-based logging SDK for Flowlog

Readme

@flowlogs/js

Simple class-based logging SDK for Flowlog. Create a logger instance and use it throughout your application.

Installation

npm install @flowlogs/js

Usage

Basic Setup

import { Flowlog } from "@flowlogs/js";

// Create a logger instance
const logger = new Flowlog({
  apiKey: "your-api-key",
  apiUrl: "https://flowlog.io/api/v1/logs",
  service: "frontend",
});

// Use it anywhere in your application
logger.info("Render", { extra: "tester" });
logger.error("Error", { error, extra: "tester" });
logger.warn("Warning", { extra: "tester" });
logger.critical("Critical", { extra: "Tester" });

Configuration Options

const logger = new Flowlog({
  apiKey: "your-api-key", // Required: Your Flowlog API key
  apiUrl: "https://flowlog.io/api/v1/logs", // Required: Flowlog API endpoint
  service: "my-service", // Optional: Service name (defaults to 'unknown')
  env: "production", // Optional: Environment (defaults to NODE_ENV or 'development')
  enableConsoleFallback: true, // Optional: Enable console fallback on API failure (default: true)
  iterationKey: "optional-key", // Optional: Iteration key for grouping related logs
});

Logging Methods

  • logger.info(message, data?) - Log an info message
  • logger.error(message, data?) - Log an error message
  • logger.warn(message, data?) - Log a warning message
  • logger.critical(message, data?) - Log a critical message (mapped to error level for API)

Console Logging

When not in production (i.e., env !== 'production'), logs are automatically printed to the console for debugging. In production, logs are only sent to the Flowlog API.

Batching

Logs are automatically batched and sent to the API for efficiency:

  • Maximum batch size: 50 logs or 64KB
  • Flush interval: 5 seconds
  • Automatic retry with exponential backoff (max 3 attempts)

Manual Flush

You can manually flush pending logs:

await logger.flush();

This is useful when you need to ensure logs are sent immediately, such as before application shutdown.

Examples

In a Logger File

// logger.ts
import { Flowlog } from "@flowlogs/js";

export const logger = new Flowlog({
  apiKey: process.env.FLOWLOG_API_KEY!,
  apiUrl: process.env.FLOWLOG_API_URL!,
  service: "my-app",
  env:
    process.env.NODE_ENV === "production"
      ? "production"
      : "development",
});

Using the Logger

// app.ts
import { logger } from "./logger";

logger.info("Application started");
logger.error("Failed to connect", {
  error: new Error("Connection failed"),
});
logger.warn("Deprecated API used", { endpoint: "/old-endpoint" });
logger.critical("System failure", { component: "database" });

TypeScript Support

Full TypeScript support with type definitions included. All types are exported:

import {
  Flowlog,
  type FlowlogConfig,
  type LogLevel,
} from "@flowlogs/js";

Browser and Node.js Support

Works in both browser and Node.js environments. In browsers, logs are automatically flushed on page unload using the keepalive fetch option.

Error Handling

If the API is unavailable:

  • Logs are queued for retry with exponential backoff
  • After max retries, logs are sent to console (if enableConsoleFallback is true)
  • In development mode, logs are always sent to console for debugging

License

MIT