It provides a way to store logs in a file in a Node environment.

import { Logger, FilePlugin } from "@koadz/logger";

const filePlugin = new FilePlugin({
logPath: "logs/app.log", // Path for all logs
errorPath: "logs/error.log", // Path for error logs
});

const Log = new Logger();
Log.registerPlugin(filePlugin);

// Usage
Log.i("This will be saved to app.log");
Log.e("This will be saved to both app.log and error.log");

Implements

Constructors

Properties

Methods

Constructors

Properties

name: string = "FilePlugin"

The name of the plugin

BasePlugin

Methods

  • Initializes the FilePlugin by ensuring it is running in a Node environment. Logs a warning if used in a browser environment. Creates the log and error files if in a Node environment.

    Returns void