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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@everlog/core

v1.0.17

Published

CSV Streamed Logger for any case

Downloads

3,214

Readme

Everlog


CircleCI npm version


Overview

This repository contains a lightweight and optimized logging library, specifically designed for both NodeJS and browser environments. The library is rewritten to offer support for both UMD and ESM modules, ensuring compatibility across a wide range of projects.

Note: "I have rewritten the library to support UMD and ESM modules for NodeJS and Browser, and to include only necessary functions for logging, without viewer and CLI capabilities. Those should be later available via additional modules."

The goal of this project is to provide essential logging functionality with minimal overhead, keeping it simple and modular. Future development will extend this functionality via separate viewer and CLI packages.

Features

  • UMD & ESM Support: Fully compatible with modern module systems for seamless integration into different environments.
  • Lightweight: Includes only the core functionality required for logging, keeping the package size minimal.
  • NodeJS and Browser Support: Works efficiently in both server and client-side environments.
  • Filesystem Logging for NodeJS:
    • Asynchronous and Efficient: Supports asynchronous logging to minimize performance overhead.
    • Buffering: Logs are buffered and written to the filesystem in batches to optimize I/O operations.
    • File Retention: Automatic file retention management ensures older log files are archived or deleted based on configured retention policies.
    • Thread Safety: Ensures thread-safe logging, preventing race conditions in multi-threaded environments or concurrent logging scenarios.
  • Structured Logging with Channels: Enables predefined logging "channels" for organizing logs, each capable of exporting structured logs in CSV format for better data analysis.
  • Future Expandability: Viewer and CLI features are planned to be available through external modules.

Usage

  1. Initialize the Everlog
import { Everlog } from 'everlog'

await Everlog.initialize({
    directory: `./logs/`,
});
  1. Create Log Streams
const channel = Everlog.createChannel<[string, number, Date]>('foo', {
    loggers: [
        {
            name: 'fs',
            // Keep only last N files
            fileCountMax: 20,
            // Limit size for a file. When reached, next file is created
            fileBytesMax: 500 * 1024;
            // Limit message count for a file. When reached, next file is created
            fileMessagesMax: 10 ** 7

            // Buffer N messages
            messageBufferMax: 50;
            columns: [] as ICsvColumn[];

            // Flush logs, when no activity was for N milliseconds
            writeTimeout: null as number;
        },
    ],

    columns: [
        { name: 'Title', filterable: true },
        { name: 'MyVal', type: 'number', sortable: true, groupable: true },
        { name: 'Timestamp', type: 'date', sortable: true, groupable: true },
    ]
});

channel.log(`Lorem ipsum`, 123, new Date());

// On the application end flush the data (in case there is smth in the buffer)
await channel.flush();

🏁


©️ MIT License.