Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atmajs/everlog
https://github.com/atmajs/everlog
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/atmajs/everlog
- Owner: atmajs
- Created: 2020-03-21T15:17:52.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-11T05:49:37.000Z (almost 2 years ago)
- Last Synced: 2024-10-25T02:42:46.128Z (21 days ago)
- Language: JavaScript
- Size: 1.51 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Everlog
-----
đ High-performance fs logging with **buffering**, **file retention**, **thread safety**, **CSV streams** and **log viewer** for every day usage.
> With `CSV` Streams (`channels`, `tables`) you make your logs structurable.
#### CLI
```bash
$ npm i -g everlog# Help
$ everlog# List all created channels
$ everlog list# Get statistic for a channel: amount of lines, files, etc.
$ everlog stats foo# Read N last lines from a channel. Supports params `offset` and `limit`
$ everlog read foo# Start viewer web-app.
$ everlog server --port=5772```
#### [API â](https://docs.atma.dev/everlog)
1. Initialize the Everlog
```ts
import { Everlog } from 'everlog'await Everlog.initialize({
directory: `./logs/`,
slack: {
token: '',
channelId: ''
}
});
```2. Create Log Streams
```ts
const channel = Everlog.createChannel('foo', {
// 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.writeRow([`Lorem ipsum`, 123, new Date()]);
// On the application end flush the data (in case there is smth in the buffer)
Everlog.flush();
```## Dev
### Core (`/src/`)
* Collects events from a server or from custom streams, and proceeds with persistence or further propagation (_slack_)
* Creates a subapp to view collected events### Viewer (`/www/`)
SubApplication to view/sort/filter collected events
* Development endpoints (_unbuild source_):
* web: `http://localhost:5771/index.dev.html`
* api, e.g: `http://localhost:5771/api/logs/channels`### Prepair
```sh
> npm i
> cd www/
> npm i
```### Start Example(_Dev Project for the viewer_)
```sh
# builds core to be available for example as lib
> npm run watch# starts demo server with Core and Viewer attached
> npm run example# navigate to http://localhost:5771/atma/monit/index.dev.html
```đ
----
Šī¸ MIT License.