New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

brahma

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brahma

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

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

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));
});

Keywords

FAQs

Package last updated on 08 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc