0.8.1 • Published 5 months ago
i0n v0.8.1
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.8.1
5 months ago
0.8.0
5 months ago
0.7.2
6 months ago
0.7.1
6 months ago
0.7.3
6 months ago
0.7.0
6 months ago
0.5.0
8 months ago
0.4.1
9 months ago
0.4.0
9 months ago
0.6.1
8 months ago
0.6.0
8 months ago
0.5.1
8 months ago
0.1.0
9 months ago
0.3.0
9 months ago
0.1.2
9 months ago
0.2.0
9 months ago
0.1.1
9 months ago
0.1.4
9 months ago
0.1.3
9 months ago
0.1.5
9 months ago
0.0.12
9 months ago
0.0.11
9 months ago
0.0.10
9 months ago
0.0.7
9 months ago
0.0.5
9 months ago
0.0.4
9 months ago
0.0.0
10 months ago