4.0.0 • Published 2 years ago

create-debug-logger v4.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Create Debug Logger

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 "create-debug-logger"

debugLog("hello world");

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

Including function name by initializing

import { createDebugLogger } from "create-debug-logger";

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 "create-debug-logger";

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

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

2 years ago

3.0.0

2 years ago

2.0.0

2 years ago

1.10.1

2 years ago

1.10.0

2 years ago

1.9.0

2 years ago

1.8.0

2 years ago

1.7.4

2 years ago

1.7.3

2 years ago

1.7.2

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago