Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rxnt-node-logger

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rxnt-node-logger

Node middleware for RxNT that takes an error object and sends it to a remote endpoint

  • 1.0.7
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

rxnt-node-logger

This project is configured to send logs from rxnt node apis to fluentd.

Install

npm install --save rxnt-node-logger

Options

The package exposes a log function that takes and error object, application environment, and a callback function that handles logging in case the api fails. Based on the environment, it will send the logs to different environment.

The log function takes arguments in following order:

  • error object - The actual error object the follows the predefined error model
  • application environment - A string values that determines the current application environment
  • logger callback - A function that will be called to save the logs in the local sotrage in case the api call fails

Usage

const rxntLogger = require('rxnt-node-logger');

let error = {
        logger: "RxntBaseClasses.ExceptionLogger.Logger",
        level: err.level ? err.level : "warn",
        user: "TemplateEngineAPI",
        host: `${config.host}`,
        logtime: new Date().toLocaleString(),
        http: {
          session_id: req.sessionId,
          http_method: req.method,
          url: req.url,
          url_referrer: req.headers.referer,
          user_agent: req.headers["user-agent"],
          user_host_address: req.headers.host,
          request_headers: req.headers,
          form_params: []
        },
        rxnt: {
          Application: `${config.application}`,
          HostedId: `${config.host}:${config.port}`,
          Message: err.message,
          Source: err.source,
          StackTrace: err.stackTrace,
          DoctorCompanyId: req.headers.doctorcompanyid,
          CompanyTypeId: err.companyTypeId,
          DoctorGroupId: req.headers.doctorgroupid,
          DoctorId: req.headers.doctorgroupid,
          LoggedInUserId: err.loggedInUserId,
          CreatedBy: err.createdBy,
          PrimaryKey: err.primaryKey, //primaryky
          OwnerType: err.ownerType,
          Token: req.headers.token,
          Signature: req.headers.signature,
          ExternalDoctorCompanyId: err.externalDoctorCompanyId,
          ExternalAppLoginId: err.externalAppLoginId,
          ConsumerIP: (req.connection !== undefined && req.connection !== null ? req.connection.remoteAddress : ''),
          ExternalApplicationName: err.externalApplicationName,
          OtherInfo: err.otherInfo,
        }
      }

      let localAppLogger = () {
        // code to handle logs in case the api service fails
      }
      // call the api with the error objectt, app environment and callback function in case the send api fails
      rxntLogger.log(errObject, process.env.DeploymentEnv, localAppLogger);

FAQs

Package last updated on 15 Nov 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc