# i0n

> A NodeJS library for logging

Latest version **0.9.0** (published 2024-12-22) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install i0n
pnpm add i0n
yarn add i0n
bun add i0n
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.0 |
| Published | 2024-12-22 |
| First published | 2023-08-10 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 104.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | x71c9 |
| Maintainers | x71c9 |

## Links

- npm: https://www.npmjs.com/package/i0n
- Repository: git@github.com:x71c9/i0n
- npm.io page: https://npm.io/package/i0n

## Dependencies (3)

- [w3i](https://npm.io/package/w3i.md) ^0.2.0
- [dateformat](https://npm.io/package/dateformat.md) ^3
- [ora-classic](https://npm.io/package/ora-classic.md) ^5.4.2

## Recent versions

- 0.9.0 (latest) — 2024-12-22
- 0.8.1 — 2023-12-30
- 0.8.0 — 2023-12-30
- 0.7.3 — 2023-11-20
- 0.7.2 — 2023-11-19
- 0.7.1 — 2023-11-19
- 0.7.0 — 2023-11-18
- 0.6.1 — 2023-10-08
- 0.6.0 — 2023-09-30
- 0.5.1 — 2023-09-13
- 0.5.0 — 2023-09-13
- 0.4.1 — 2023-08-23
- 0.4.0 — 2023-08-23
- 0.3.0 — 2023-08-22
- 0.2.0 — 2023-08-21
- … 13 more at https://npm.io/package/i0n/versions

## README

# i0n

A typescript library for console logging.

## Implementation

A common implementation is the following:

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

export const log = ion.create({
  log_level: ion.LOG_LEVEL.NONE,
});
```

```typescript
// 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

```typescript
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

```typescript
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](https://en.wikipedia.org/wiki/Unix_philosophy).

## Name

`i0n` stands for ion, like in [Ion](https://en.wikipedia.org/wiki/Ion).

## Other related repositories

[`3xp`](https://www.npmjs.com/package/3xp) A typescript library for validating objects.

[`r4y`](https://www.npmjs.com/package/r4y) A typescript library for managing child processes.

[`w3i`](https://www.npmjs.com/package/w3i) A typescript library for handling configurations.

---
_Source: https://npm.io/package/i0n · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
