@icord/logger
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

icord


Discord server npm version npm downloads

A library for logging your projects to a new level!

📦 Installation

npm install @icord/logger

📖 Usage

Example 1

import { Logger } from "@icord/logger";

const logger = new Logger("ClassName"); // options: { delay: true, writeStreamType: "stderr", timestamp: "en-US" }

logger.log("Log");
logger.error("Error");
logger.warn("Warn");
logger.success("Success");
logger.verbose("Verbose");
logger.event("Event");
logger.debug("Debug");

Example 2

import { Logger } from "@icord/logger";

class ExampleLogger {
    private logger = new Logger(ExampleLogger.name, { delay: true, timestamp: "en-US" })

    constructor() {
        this.logger.log("Log");
        this.logger.error("Error");
        this.logger.warn("Warn");
        this.logger.success("Success");
        this.logger.verbose("Verbose");
        this.logger.event("Event");
        this.logger.debug("Debug");
    }
}

Example 3

  • Also make sure that the "experimentalDecorators": true option is enabled in your TypeScript config file tsconfig.json to use decorators.
import { IcordLogger, LoggerService } from "@icord/logger";

class ExampleLogger {
    @IcordLogger(ExampleLogger.name, { /* options here */ })
    logger!: LoggerService;

    constructor() {
        this.logger.log("Log");
        this.logger.error("Error");
        this.logger.warn("Warn");
        this.logger.success("Success");
        this.logger.verbose("Verbose");
        this.logger.event("Event");
        this.logger.debug("Debug");
    }
}

📸 Example

🔗 Options

  • timestamp — Is not a declaration of a custom Timestamp type, which can take only three values: "en-US", "de-DE" or "ru-RU".
  • writeStreamType — Is an optional writeStreamType field that can take only two values: "stdout" or "stderr".
  • delay — Is an optional delay field that can take boolean values.

☎️ Contact

Package Sidebar

Install

npm i @icord/logger

Weekly Downloads

3

Version

1.0.7

License

MIT

Unpacked Size

29.5 kB

Total Files

9

Last publish

Collaborators

  • icord
  • whymind
  • nxtxe