# named-logs

> minimal logging facet for libraries

Latest version **0.4.1** (published 2025-11-27) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2025-11-27 |
| First published | 2020-08-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 14 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ronan Sandford |
| Maintainers | wighawag |
| Keywords | console, logger, logging, logging facade, microscopically small, tiny, 1kB |

## Links

- npm: https://www.npmjs.com/package/named-logs
- Repository: https://github.com/wighawag/named-logs
- Homepage: https://github.com/wighawag/named-logs#readme
- Issues: https://github.com/wighawag/named-logs/issues
- npm.io page: https://npm.io/package/named-logs

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 0.4.1 (latest) — 2025-11-27
- 0.2.4-patchable (patchable) — 2024-05-07
- 0.4.0 — 2025-11-27
- 0.3.2 — 2025-01-26
- 0.3.1 — 2025-01-26
- 0.3.0 — 2024-10-24
- 0.2.4 — 2024-04-10
- 0.2.3 — 2024-04-10
- 0.2.2 — 2023-03-15
- 0.2.1 — 2022-11-29
- 0.2.0 — 2022-08-24
- 0.1.0 — 2021-05-20
- 0.0.13 — 2020-09-23
- 0.0.12 — 2020-09-23
- 0.0.10 — 2020-09-23
- … 9 more at https://npm.io/package/named-logs/versions

## README

# install

```bash
npm install named-logs
```

# use in library

```js
import {logs} from 'named-logs';
const console = logs('yourLibraryName');

console.log('whatever you want');
console.error('an error occured');
```

you can also add a decoration option which log renderer can use to add color, etc.. it expect a css string

```js
import {logs} from 'named-logs';
const console = logs('yourLibraryName', 'background: #222; color: #bada55');
```

# use in application

If you use a logging library that support `named-logs` you might not need to do anything else, except importing that lib that will call hook by itself.

For example, with [named-logs-console](https://github.com/wighawag/named-logs-console#readme) you can simply do in your root file (index.js)

```js
import {hookup} from 'named-logs-console';
hookup();
```

And now any library that use `named-logs` will have their log outputted to console but with full control on the app side. See [named-logs-console](https://github.com/wighawag/named-logs-console#readme) for more details.

You can also use `named-logs` for making the logging calls, this way part of your app can be broken up into self contained libary without requiring any logging library expect for `named-logs` facade.

# `named-logs` is a facade

`named-logs` basically act as a minimal facade for logging with minimal overhead while remaining flexible. Perfect for libraries that want to remain agnostic to the logging method used. the esm module weight less than 926 bytes.

you can build your own handler, by doing the following:

```js
import {hook} from 'named-logs';
hook((namespace) => {
  return window.console;
});
```

This is a simple example that will make all log use `window.console`.
namespace will not be used here though. see [named-logs-console](https://github.com/wighawag/named-logs-console#readme) for a logger that supprt `window.console` with namespace/log level filtering.

to have it working with bundler the best way is to inject a script tag, see https://github.com/wighawag/named-logs-console#readme

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