good-slog

1.0.0 • Public • Published

good-slog

Slog or structured logging is a way to log data in a structured manner. This package makes sure you have a beutiful looking terminal while keeping your logs structured.

Installation

npm install good-slog

Usage

import { log, info, warning, error } from 'good-slog';

// or

const slog = require('good-slog');

Examples

log('Hello World');

To keep a record of all your logs, lets say in an object, you can call the callback function.

import { log } from 'good-slog';
const logs = [];
log('Hello World', (m) => logs.push(m));

To write to a file

import * as fs from 'fs';
import { log } from 'good-slog';

log('Hello World', (m) => 
    fs.writeFileSync('logs.json', JSON.stringify(m))
);

Functions

There is a total of 4 exported functions.

log

log('Hello World');

info

info('Hello World');

warning

warning('Hello World');

error

error('Hello World');

Readme

Keywords

none

Package Sidebar

Install

npm i good-slog

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

5.7 kB

Total Files

4

Last publish

Collaborators

  • onrir