# debug-logging

> Simple debug logging.

Latest version **5.2.5** (published 2023-05-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install debug-logging
pnpm add debug-logging
yarn add debug-logging
bun add debug-logging
```

## Health

**Score 30/100 (F)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.2.5 |
| Published | 2023-05-27 |
| First published | 2022-08-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=14 |
| Dependencies | 1 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | C. Lewis |
| Maintainers | ctjlewis |

## Links

- npm: https://www.npmjs.com/package/debug-logging
- npm.io page: https://npm.io/package/debug-logging

## Dependencies (1)

- [@tsmodule/log](https://npm.io/package/@tsmodule/log.md) ^3.0.6

## Recent versions

- 5.2.5 (latest) — 2023-05-27
- 5.2.4 — 2023-05-27
- 5.2.3 — 2023-05-27
- 5.2.2 — 2023-05-27
- 5.2.1 — 2023-05-27
- 5.2.0 — 2023-05-27
- 5.1.2 — 2023-05-27
- 5.1.1 — 2023-05-27
- 5.1.0 — 2023-05-27
- 5.0.0 — 2023-05-27
- 4.1.3 — 2023-05-27
- 4.1.2 — 2022-11-24
- 4.1.1 — 2022-11-24
- 4.1.0 — 2022-11-24
- 4.0.4 — 2022-08-11
- … 4 more at https://npm.io/package/debug-logging/versions

## README

# Debug Logging

This module provides a few ways to log to the console in development
environments only.  **Debug logs will be removed when `process.env.NODE_ENV ===
"production".**

### Quick, devleopment-only logging

```ts
import { debugLog } from "debug-logging"

debugLog("hello world");

// if process.env.NODE_ENV !== "production", logs:
// [DEBUG] [debugLog] hello world
```

### Including function name by initializing

```ts
import { createDebugLogger } from "debug-logging";

export const testFunction = () => {
  const DEBUG = createDebugLogger(testFunction);
  DEBUG.log("hello world");
}

// if process.env.NODE_ENV !== "production", logs:
// [DEBUG] [testFunction] hello world
```

### As a class method decorator, if you want that for some reason

```ts
import { debugMethod } from "debug-logging";

class Person {
  @debugMethod
  greet(name: string): string {
    return `hello ${name}`;
  }
}

new Person().greet("world");
// [DEBUG] greet("world") [CALL]
// [DEBUG] greet("world") => "hello world" [RETURN]
```

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