debug-logger.ts in Flyde codebase.

Ramu NarasingaRamu Narasinga
1 min read

In this article, we will review debug-logger.ts in Flyde codebase. We will look at:

  1. debugLogger function

  2. debug package

debugLogger function

You will find the following code at flyde/core/src/common/debug-logger.ts

import debug from "debug";

const BASE_NS = `flyde`;

const base = debug(BASE_NS);

import type { Debugger as _Debugger } from "debug";

export type DebugLogger = _Debugger;

export const debugLogger = (subNs: string): DebugLogger => {
  return base.extend(subNs);
};

debug is imported and is assigned to base . In the debugLogger function, base is extended with the parameter passed.

debug package

A tiny JavaScript debugging utility modelled after Node.js core’s debugging technique. Works in Node.js and web browsers.

Installation

 npm install debug

Usage

Check out the debug usage in the documentation

About me:

Hey, my name is Ramu Narasinga. I study codebase architecture in large open-source projects.

Email: ramu.narasinga@gmail.com

Want to learn from open-source? Solve challenges inspired by open-source projects.

References:

  1. https://github.com/flydelabs/flyde/blob/main/core/src/common/debug-logger.ts#L11

  2. https://www.npmjs.com/package/debug

  3. https://github.com/flydelabs/flyde/blob/main/core/src/execute/index.ts#L103

0
Subscribe to my newsletter

Read articles from Ramu Narasinga directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ramu Narasinga
Ramu Narasinga

I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.