# @nexssp/logdebug

> Just log/debug for not only the Nexss Programmer..

Latest version **1.1.0** (published 2025-04-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nexssp/logdebug
pnpm add @nexssp/logdebug
yarn add @nexssp/logdebug
bun add @nexssp/logdebug
```

## Health

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

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

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2025-04-24 |
| First published | 2020-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 13.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Marcin Polak |
| Maintainers | nexss |
| Keywords | log, debug, error, tracker, nexss, nexss programmer |

## Links

- npm: https://www.npmjs.com/package/@nexssp/logdebug
- Repository: https://github.com/nexssp/logdebug
- Homepage: https://nexss.com
- Issues: https://github.com/nexssp/logdebug/issues
- npm.io page: https://npm.io/package/@nexssp/logdebug

## Dependencies (2)

- [@nexssp/ansi](https://npm.io/package/@nexssp/ansi.md) ^1.1.4
- [@nexssp/extend](https://npm.io/package/@nexssp/extend.md) ^2.0.9

## 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

- 1.1.0 (latest) — 2025-04-24
- 1.0.20 — 2022-01-15
- 1.0.18 — 2021-05-27
- 1.0.17 — 2021-05-27
- 1.0.16 — 2021-05-24
- 1.0.15 — 2021-05-10
- 1.0.14 — 2021-05-10
- 1.0.13 — 2021-05-10
- 1.0.12 — 2021-05-04
- 1.0.11 — 2020-10-20
- 1.0.10 — 2020-10-12
- 1.0.9 — 2020-10-12
- 1.0.8 — 2020-10-12
- 1.0.7 — 2020-10-11
- 1.0.6 — 2020-10-07
- … 3 more at https://npm.io/package/@nexssp/logdebug/versions

## README

# @nexssp/logdebug

**25.06.2024 TypeScript Support** - Added TypeScript type definitions for better development experience.
**15.01.2022 Upgrade** - Now works also with `import` as module.

## News

- New **1.0.17**: tracking functions. `--debug:all` or `--debug:tracker` more below

## More

Note: **1.0.15** Now by default all logs and debug funcs goes to stdout - except error one. To move all of them to stderr: `--output:stderr`

Note: **1.0.12+**
Now **header** function is size of terminal window.

Note: **1.0.11+ See new time functions below ..**

Easy loging/debuging. Going to stderr if `--debug`. You can change from stderr to stdout easy by another option `--debug:stdout`. You can disable logs just by adding `--quiet`. Maybe you need just debug information, combine it with `--quiet --debug`.

## Debug and Log functions and colors

![Nexss Log and Debug functions](https://user-images.githubusercontent.com/53263666/117049034-f4530f00-ad13-11eb-95f1-a4d80e42ec7d.png)

## Parameters

This library is designed just to use cli process.argv directly.

- **yourprogram.js --debug** # will display debugging information, without it won't.
- **yourprogram.js --debug:stdout** # will pipe to stdout.
- **yourprogram.js --quiet** # will hide logs information

## Examples

note: below must be run with `--debug` or `--debug:stdio` . if you add `--quiet`, logs will not be displayed.

```js
const log = require('@nexssp/log')
const { bold } = require('@nexssp/ansi')
// You can display debug infor by --debug or --debug:stdout
log.dy('\t Debug yellow: ' + bold('log.dy'))
log.dr('\t Debug red: ' + bold('log.dr'))
log.dg('\t Debug green: ' + bold('log.dg'))
log.di('\t Debug bold: ' + bold('log.di'))
log.db('\t Debug blue: ' + bold('log.db'))
log.du('\t Debug underscore: ' + bold('log.du'))

// You can bellow hide by --quiet
log.warn('\t Warning message ' + bold('log.warn'))
log.error('\t error message ' + bold('log.error'))
log.info('\t info message ' + bold('log.info'))
log.success('sucess message ' + bold('log.success'))
log.ok('\t ok message ' + bold('log.ok'))
log.trace('\t trace message ' + bold('log.trace'))
```

## Time options (1.0.11+)

#### --debug:ms

displays time from the begining.

![image](https://user-images.githubusercontent.com/8799218/96580565-c60e6480-12d8-11eb-82d0-e86516016299.png)

#### --debug:diff

Displays difference between each log.

![image](https://user-images.githubusercontent.com/8799218/96580751-0b329680-12d9-11eb-888a-14c2ce2b9dc1.png)

### Usage of tracker

#### External Usage

```js
const o = {
  run, // tracker will be only added to the functions
  start,
  var1, //Will not be added, only functions
}
const { applyTracker } = require('@nexssp/logdebug/tracker')
applyTracker(o, null)
```

#### Composite

```js
const { functionTracker } = require('../tracker')
function myComposite(a, b, { option1, option2 } = {}) {
  const _a = a
  const _b = b

  const trackFunction = functionTracker('mytitle')

  let myfunc2 = (param2) => {
    console.log(`${_b}`, param2)
  }

  let myfunc1 = (param1) => {
    console.log(`${_a}: ${param1}`)
    myfunc2(`${_a}: ${param1}`, 'works!')
  }

  myfunc1 = trackFunction(myfunc1)
  myfunc2 = trackFunction(myfunc2)

  let o = {
    myfunc1,
    myfunc2,
  }
  // applyTracker(o)

  return o
}

const compo = myComposite(1, 'string')
compo.myfunc1(1, 2, 3)
compo.myfunc2(1, 2, 3)
```

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