Home > Web Front-end > JS Tutorial > \'npm kruza: A logger with Source Tracing\'

\'npm kruza: A logger with Source Tracing\'

Susan Sarandon
Release: 2024-12-03 21:46:10
Original
953 people have browsed it

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!
Copy after login

The above is the detailed content of \'npm kruza: A logger with Source Tracing\'. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template