oneuptime/log-js
2020-06-30 17:01:37 +01:00
..
src api url update for js 2020-06-29 21:31:43 +01:00
test api url update for js 2020-06-29 21:31:43 +01:00
.babelrc private fields un setable frok outside 2020-06-11 11:11:49 +01:00
.gitignore git ignore + logger 2020-06-08 14:06:20 +01:00
package-lock.json removeed unused packaged + change test to enterprise for the library 2020-06-27 10:08:43 +01:00
package.json removeed unused packaged + change test to enterprise for the library 2020-06-27 10:08:43 +01:00
README.md readme updated + gitignore 2020-06-30 17:01:37 +01:00
webpack.config.js preset bug 2020-06-09 16:15:12 +01:00

Fyipe Application Logger

A fyipe application logger that can be used to send logs about your applications created on your fypie dashboard

Installation

NPM Install

You can install to use in your project:

$ cd project
$ npm install fyipe-log-js

Development

  • Clone repository
  • run npm i to install dependencies
  • run npm run test to run tests
  • run npm run build to build for production.

Basic Usage

import Logger from 'log-js';

// constructor
const logger = new Logger(
    'API_URL', // https:fyipe.com/api
    'APPLICATION_LOG_ID',
    'APPLICATION_LOG_KEY'
);

// Sending a string log to the server
const item = 'This is a simple log';

logger.log(item); // returns a promise

// Sending a JSON object log to the server
const item = {
    user: 'Test User',
    page: {
        title: 'Landing Page',
        loadTime: '6s',
    },
};

logger.log(item); // returns a promise

API Documentation

Main API to send logs to the server.

Author: HackerBay, Inc.

new Logger(apiUrl, applicationId, applicationKey)

Create a constructor from the class, which will be used to send logs to the server.

Kind: Constructor Returns: null

Param Type Description
apiUrl string The Server URL.
applicationId string The Application Log ID.
applicationKey string The Application Log Key.

logger.log(log)

Logs a request of type info to the server.

Kind: method of new Logger Returns: Promise - A promise response of a success or failure.

Param Type Description
log string | Object The content to the logged on the server.

logger.warning(log)

Logs a request of type warning to the server.

Kind: method of new Logger Returns: Promise - A promise response of a success or failure.

Param Type Description
warning string | Object The content to the logged on the server.

logger.error(log)

Logs a request of type error to the server.

Kind: method of new Logger Returns: Promise - A promise response of a success or failure.

Param Type Description
error string | Object The content to the logged on the server.

TODO

  • Tags
  • TBD