5.2.5 • Published 12 months ago

debug-logging v5.2.5

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

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

import { debugLog } from "debug-logging"

debugLog("hello world");

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

Including function name by initializing

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

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]
5.2.4

12 months ago

5.2.3

12 months ago

5.2.2

12 months ago

5.2.1

12 months ago

5.1.2

12 months ago

5.2.0

12 months ago

5.1.1

12 months ago

5.1.0

12 months ago

5.0.0

12 months ago

4.1.3

12 months ago

5.2.5

12 months ago

4.1.0

1 year ago

4.1.2

1 year ago

4.1.1

1 year ago

4.0.4

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago