1.1.9 • Published 1 year ago

@icord/logger v1.1.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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](https://github.com/icordjs/icord/blob/main/packages/logger/example/emample2.ts)
```js
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 
- [Check example](https://github.com/icordjs/icord/tree/main/packages/logger/example)

![](https://github.com/icordjs/icord/blob/main/packages/logger/example/example.png) 

# 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

- [Discord server](https://discord.gg/qS9wGazSgp)
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.1.9

1 year ago

1.0.9

1 year ago

1.1.7

1 year ago

1.0.8

1 year ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

0.0.2

1 year ago

0.0.1

2 years ago