DEV Community

Cover image for "npm kruza: A logger with Source Tracing"
DaniilPak
DaniilPak

Posted on

"npm kruza: A logger with Source Tracing"

Automatically tracing and displaying the source (function/class) of the log.
Providing colorful and readable logs for better visibility.
Offering a clean and simple API for logging multiple arguments.

import _ from "kruza";

class Boxer {
  punch() {
    _.log("Punch");
  }
}

class Police {
  eatDonut() {
    _.log("Eating donut");
  }
}

class UFC_Champ {
  koSomeone() {
    _.log("BAM!");
  }
}

const b = new Boxer();
b.punch(); // Output: [Boxer.punch] Punch

const p = new Police();
p.eatDonut(); // Output: [Police.eatDonut] Eating donut

const ufc = new UFC_Champ();
ufc.koSomeone(); // Output: [UFC_Champ.koSomeone] BAM!
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay