Socket
Socket
Sign inDemoInstall

i0n

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i0n

A NodeJS library for logging


Version published
Weekly downloads
3
decreased by-90.32%
Maintainers
1
Weekly downloads
 
Created
Source

i0n

A typescript library for console logging.

Implementation

A common implementation is the following:

// src/log/index.ts
import ion from 'i0n';

export const log = ion.create({
  log_level: ion.LOG_LEVEL.NONE,
});
// src/business.ts
import {log} from './log/index.js';

log.trace(`trace`);
log.debug(`debug`);
log.info(`info`);
log.warn(`warn`);
log.error(`error`);
log.success(`success`);
log.fail(`fail`);

Full configuration

import ion from 'i0n';

ion.create({
  log_level: ion.LOG_LEVEL.WARN,
  color: false,
  prefix: '[myapp] ',
  force_spin: false,
  trace: {
    method: 'trace',
    color: '#999',
  },
  debug: {
    method: 'debug',
    color: '#CDCDCD',
  },
  info: {
    method: 'info',
    color: '#99F',
  },
  warn: {
    method: 'warn',
    color: '#FF7700',
  },
  error: {
    method: 'error',
    color: '#DD1122',
  },
  success: {
    method: 'log',
    color: '#55DD88',
  },
  fail: {
    method: 'log',
    color: '#770000',
  },
});

Spinner

import ion from 'i0n';

ion.spinner.text('Loading...');
ion.spinner.start();

setTimeout(() => {
  ion.spinner.stop();
}, 4000);

Unix philosophy

This repo try to follow the Unix philosophy.

Name

i0n stands for ion, like in Ion.

3xp A typescript library for validating objects.

r4y A typescript library for managing child processes.

w3i A typescript library for handling configurations.

FAQs

Package last updated on 30 Dec 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

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