lgfl

1.0.0 • Public • Published

Log File

npm version

"log-file" is a lightweight Node.js library for file-based logging.

Installation

npm install lgfl

Usage

const log = require("lgfl");

const consoleLog = log("./path/to/console.log");
consoleLog("Log message");

function onError(err) {
  log.onError(err, "./path/to/errors.log");
}

try {
  // Your code that may generate an error
} catch (err) {
  onError(err);
}

API

log(filePath: string): Function

Creates a log function that appends messages to the specified file path.

  • filePath (string): The path to the log file.

onError(err: Error, filePath: string): void

Logs error details to the specified file path.

  • err (Error): The error object to log.
  • filePath (string): The path to the error log file.

Package Sidebar

Install

npm i lgfl

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

2.63 kB

Total Files

7

Last publish

Collaborators

  • aethera