# saylo

> use logger.log instead of console.log and you can mute unmute (turn on or off) console.log calls

Latest version **0.6.3** (published 2025-09-24) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 35/100 (D)** — status: maintenance-mode.

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

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

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.3 |
| Published | 2025-09-24 |
| First published | 2019-08-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 26.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Guillermo Pages |
| Maintainers | guillermo_at |
| Keywords | log |

## Links

- npm: https://www.npmjs.com/package/saylo
- Repository: https://github.com/gbili/saylo
- Homepage: https://github.com/gbili/saylo#readme
- Issues: https://github.com/gbili/saylo/issues
- npm.io page: https://npm.io/package/saylo

## 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.6.3 (latest) — 2025-09-24
- 0.6.2 — 2025-02-24
- 0.6.1 — 2025-02-24
- 0.6.0 — 2025-02-24
- 0.5.1 — 2021-09-16
- 0.5.0 — 2020-02-19
- 0.4.0 — 2020-02-16
- 0.3.0 — 2020-02-15
- 0.2.3 — 2019-08-11
- 0.2.2 — 2019-08-11
- 0.2.1 — 2019-08-11
- 0.2.0 — 2019-08-11
- 0.1.3 — 2019-08-06
- 0.1.0 — 2019-08-06

## README

# Saylo

Saylo is a slim logging helper that wraps the standard console and adds
timestamped output. It ships a couple of preconfigured loggers and a tiny
factory so you can decide—per environment—which levels should print and which
ones should stay silent.

## Installation

npm install saylo

## Quick start

```js
import chattyLogger, { logger, silentLogger, createLogger } from 'saylo';

chattyLogger.log('Everything is enabled by default');
chattyLogger.debug('Debug output includes a timestamp and level tag');

logger.log('Only log/info/warn/error are enabled here (debug is muted)');

silentLogger.log('This will not print');

const LOGGER_LOG = process.env.LOGGER_LOG === '1';
const LOGGER_DEBUG = process.env.LOGGER_DEBUG === '1';
const appLogger = createLogger({ LOGGER_LOG, LOGGER_DEBUG });

appLogger.log('Respects LOGGER_LOG');
appLogger.debug('Respects LOGGER_DEBUG');
```

Each message is prefixed with a timestamp in the [YYYY-MM-DD HH:mm:ss] [LEVEL] form.

## API

### createLogger(options?)

```js
createLogger({
  LOGGER_LOG: boolean;   // defaults to true – controls log/info/warn/error
  LOGGER_DEBUG: boolean; // defaults to true – controls debug (and info if you want it chatty)
}) => Logger
```

Disabled levels simply map to a no-op (() => undefined), so calling them is cheap.

### Logger methods

- `log(message, ...meta)`
- `debug(message, ...meta)`
- `info(message, ...meta)`
- `warn(message, ...meta)`
- `error(message, ...meta)`

All methods mirror console.* semantics: they accept any extra arguments and pass
them straight through to the console.

## Built-in instances

- `chattyLogger` (default export) – `log`, `debug`, `info`, `warn`, `error` all enabled.
- `logger` – `log`/`info`/`warn`/`error` enabled, debug muted.
- `silentLogger` – everything muted.

Because the factory is tiny you can create as many bespoke loggers as you like,
with whatever combination of flags or wrapping logic you need.

## Tips

- Pipe environment variables (`LOGGER_LOG`, `LOGGER_DEBUG`) into `createLogger` if you want to control output without touching call sites.
- Timestamp helpers live in `src/funcs.ts`; swap them if you prefer different formatting.
- There’s no buffering or transport layer—if you need to wire the logger into another system, just wrap the functions returned by createLogger.

## License

MIT

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