human-incubator-centralized-error-logger

1.0.15 • Public • Published

Steps to use the package.

  1. Indentify and get the client token from centralized error app (test server or production).

  2. There are 2 ways to make an api request to centralized error using this plugin both requires you to install axios library in your project

    • Using log() function: This is intended for non-nuxt application since the axios used on this function is based on the original axios library
    • Using logWithAxios() function: This can be used for Nuxt application project or others that have already built-in nuxt application embeded on the framework. The user is require to pass the axios instance on this method.
  3. use the library as easy as:

    const log = require('./index');
    const axios = require('axios');
    
    let params = {
        axios: axios,
        mode: 'test',
        token: 'testkey123',
        message: 'this is a test form js library 123',
        user_name: 'john mark',
        category: 'FORM_VALIDATION',
        error_code: 'TEXT_FORMAT',
        severity: 'Low',
    }
    
    log.logWithAxios(params);
    

    OR

    const log = require('./index');
    
    let params = {
        mode: 'test',
        token: 'testkey123',
        message: 'this is a test form js library 123',
        user_name: 'john mark',
        category: 'FORM_VALIDATION',
        error_code: 'TEXT_FORMAT',
        severity: 'Low',
    }
    
    log.logWithAxios(params);
    

MODE: value should be either "test" or "production". setting the mode to "test" will log all the errors in the Centralized error test server while setting it to "production" will on the other hand log all the error in the centralized error production server.

TOKEN: The preffered API key of your project. You can check what token to be used on centralized error projects (test of production servers).

MESSAGE: Is the message that you want to log in the centralized error project.

USER_NAME: This will serve as the user who were responsible on making the error.

CATEGORY: (ID or CODE), this will categorize the error to be logged. several categories can be checked on the centralized error app as well.

ERROR_CODE: (ID or CODE), this will categorize the error to be logged per error code. several error codes can be checked on the centralized error app as well.

SEVERITY: (Low, Normal, High, Extremely High);

Readme

Keywords

none

Package Sidebar

Install

npm i human-incubator-centralized-error-logger

Weekly Downloads

10

Version

1.0.15

License

ISC

Unpacked Size

6.34 kB

Total Files

4

Last publish

Collaborators

  • human-incubator-jm