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);// UsageLog.i("This will be saved to app.log");Log.e("This will be saved to both app.log and error.log"); Copy
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);// UsageLog.i("This will be saved to app.log");Log.e("This will be saved to both app.log and error.log");
Optional
Readonly
The name of the plugin
BasePlugin
Stores the log entry in a file in node environment
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.
It provides a way to store logs in a file in a Node environment.
Example