logforge

2.0.3 • Public • Published

LogForge

Forge efficient log management with LogForge. Streamline error tracking, debugging, and gain insights into your application. Powerful tools for creating, managing logs, and an intuitive dashboard for seamless integration.

Installation

npm install logforge

Importing LogForge

To import LogForge in your JavaScript or TypeScript project, you can use either the ES6 import syntax or the CommonJS require syntax:

ES6 Import Syntax

import LogForge from "logforge";

CommonJS Require Syntax

const LogForge = require("logforge");

Initializing LogForge

Default Initialization

const errorLogger = new LogForge();

Custom Initialization

You can pass custom file names and folder locations when creating a new instance.

const customErrorLogger = new LogForge({
  errorLogFileName: 'errors.txt', // Custom log file name
  logsFolderName: 'error_logs',   // Custom folder for logs
});

Usage

1. Logging Errors with logErrorInfo

Use the logErrorInfo method to log error information. Simply pass an error object as a parameter.

// Import LogForge
import LogForge from "logforge.js";

// Initialize LogForge
const errorLogger = new LogForge();

try {
  console.log(x); // Your code that might throw an error
} catch (error) {
  // Log the error using LogForge
  errorLogger.logErrorInfo(error);
}

2. Reading Logged Errors with readErrors

Use the readErrors method to retrieve logged error information.

errorLogger.readErrors();

Readme

Keywords

none

Package Sidebar

Install

npm i logforge

Weekly Downloads

13

Version

2.0.3

License

MIT

Unpacked Size

7.64 kB

Total Files

5

Last publish

Collaborators

  • zsnippet-creator