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

brahma

v1.0.5

Published

Brahma. Minimal and extremely opinionated offline logging and metrics solution.

Downloads

22

Readme

Brahma. Minimal and extremely opinionated offline logging and metrics solution.

Build Status Circle CI

Summary

While most of the projects we work on are online and can use Internet sometimes we encounter interesting offline projects for various expos, games etc. While offline these apps still need logging, metrics or analytics and this library aims to solve it.

Library designed to be non-configurable, drop-in solution, it suited my clients in the past, so I decided to share it. If you need configurable offline logging there are other solutions.

How it works

Brahma will create directory if it doesn't exist already and will fill it up with csv files as it goes, it will write them to a new line, but will lazily create new csv file every hour (only if it needs to write something). To avoid keeping file stream opened for a long time. CSV format is fixed to following columns:

  • Date-time in ISO-8601, for entities who can't read EPOCH.
  • EPOCH so we have useful date-time format.
  • Category: Enough said.
  • Action: Enough said.
  • Tags: If category and action is not to describe.
  • Notes: Run out of tags?

Usage

// Import http, socket, logging etc.
import http from 'http';
import express from 'express';
import socketIo from 'socket.io';
import {metrics} from 'brahma';

// Initialise socket
const app = express();
const server = http.Server(app);
server.listen(7777);
const io = socketIo(server);
const metricsSocket = io.of('/metrics');

// Create meter function, that will do actual logging.
// Meter function will create new directory "metricsDirectory" and
// it will create new metrics file every ten minutes.
const meter = metrics('metricsDirectory');

metricsSocket.on('connection', (socket) => {
  // Every time socket receives event "meter"
  // it will log category, action and tags.
  socket('meter', ({category, action, tags}) => meter(category, action, tags));
});