Brahma. Minimal and extremely opinionated offline logging and metrics solution.
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.;;;; // Initialise socketconst app = ;const server = http;server;const io = ;const metricsSocket = io; // 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 = ; metricsSocket;