0.9.0 • Published 7 months ago

i0n v0.9.0

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
7 months ago

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.

Other related repositories

3xp A typescript library for validating objects.

r4y A typescript library for managing child processes.

w3i A typescript library for handling configurations.

0.9.0

7 months ago

0.8.1

2 years ago

0.8.0

2 years ago

0.7.2

2 years ago

0.7.1

2 years ago

0.7.3

2 years ago

0.7.0

2 years ago

0.5.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.1

2 years ago

0.1.0

2 years ago

0.3.0

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.5

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.7

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.0

2 years ago