1.1.9 • Published 1 year ago
@icord/logger v1.1.9
Installation
npm install @icord/loggerUsage
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": trueoption 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)

# 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)