# micro-logs

> A minimal, console-only logging utility that behaves exactly like logs-gateway console logging, with optional fail-fast error throwing.

Latest version **1.0.5** (published 2026-03-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install micro-logs
pnpm add micro-logs
yarn add micro-logs
bun add micro-logs
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2026-03-20 |
| First published | 2025-12-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 38.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | nx-morpheus |

## Links

- npm: https://www.npmjs.com/package/micro-logs
- npm.io page: https://npm.io/package/micro-logs

## Recent versions

- 1.0.5 (latest) — 2026-03-20
- 1.0.4 — 2026-01-08
- 1.0.3 — 2026-01-08
- 1.0.1 — 2026-01-08
- 1.0.0 — 2025-12-22

## README

# micro-logs

A minimal, console-only logging utility that behaves exactly like logs-gateway console logging, with optional fail-fast error throwing.

## Features

*   **Console-only**: Zero support for files, transports, or complex routing.
*   **Environment-driven**: Configuration via environment variables.
*   **Logs-gateway parity**: Identical log-level semantics and behavior.
*   **Fail-fast**: Error logs throw by default (configurable).
*   **Zero dependencies**: Lightweight and predictable.

## Installation

```bash
npm install micro-logs
```

## Usage

```typescript
import { Logger } from 'micro-logs';

const logger = new Logger({
  packageName: 'my-service',
  debugNamespace: 'api:v1' // Optional
});

logger.info('Server started');
logger.debug('Processing request'); // Suppressed by default
logger.error('Database connection failed'); // Throws by default
```

## Configuration

### Log Levels

Logs are filtered based on a minimum threshold. Supported levels (ordered):
1. `verbose`
2. `debug`
3. `info` (default)
4. `warn`
5. `error`

Configure via: `{ENV_PREFIX}_LOG_LEVEL` (e.g., `LOG_LEVEL=debug`).

### DEBUG Namespace

Enable `verbose` and `debug` logs for specific namespaces without lowering the global level.

Configure via: `DEBUG` (e.g., `DEBUG=api:*,auth`).

### Error Throwing

By default, calling `logger.error()` will throw an `Error`.

Configure via: `{ENV_PREFIX}_THROW_ERROR` (values: `true` | `false`).

## License

ISC

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