New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

logforge

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

logforge

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

latest
Source
npmnpm
Version
2.0.3
Version published
Maintainers
1
Created
Source

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();

FAQs

Package last updated on 10 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts