🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

good-slog

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

good-slog

Simple and minimal structured logging for Node or Bun

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 16 Sep 2023

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