npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fyipe-log-js

v3.0.6657

Published

A fyipe JS package that send logs from your applications to your fyipe dashboard.

Downloads

14

Readme

npm

Fyipe Application Logger

A fyipe application logger that can be used to send logs about your applications created on your fypie dashboard. It also provides a way to track errors in your application.

Installation

NPM Install

You can install to use in your project:

$ cd project
$ npm install fyipe-log-js

Basic Usage

In a Node.js Project

import { FyipeLogger } from 'fyipe-log-js';

// constructor

// set up tracking configurations
const options = {
    maxTimeline: 10,
};
const logger = new FyipeLogger(
    'API_URL', // https://fyipe.com/api
    'APPLICATION_LOG_ID',
    'APPLICATION_LOG_KEY',
    options // Optional Field
);

// 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

// Alternatively, Logs can be tagged with either a string or an array of strings
const item = 'This is a simple log';
const tags = ['server', 'script', 'dev'];
logger.log(item, tags);

const tag = 'testing';
logger.log(item, tag);

In the Browser

<script src="https://unpkg.com/fyipe-log-js"></script>
<script>
    function logError() {
        // constructor
        const logger = new FyipeLogger(
            '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

        // Alternatively, Logs can be tagged with either a string or an array of strings
        const item = 'This is a simple log';
        const tags = ['server', 'monitor'];
        logger.log(item, tags);
    }
</script>

Error Tracking APIs

import { FyipeTracker } from 'fyipe-log-js';

// constructor

// set up tracking configurations
const options = {
    maxTimeline: 10,
};
const tracker = new FyipeTracker(
    'API_URL', // https://fyipe.com/api
    'ERROR_TRACKER_ID',
    'ERROR_TRACKER_KEY',
    options // Optional Field
);

// capturing a timeline manually
tracker.addTimeline(
    'payment',
    { account: 'debit', amount: '6000.00', userId: 401 },
    'info'
);

// setting custom tags
tracker.setTag('category', 'Customer'); // a single tag
tracker.setTags([
    { key: 'type', value: 'notice' },
    { key: 'location', value: 'online' },
]); // an array of tags

// capturing error exception authomatically
NonExistingMethodCall(); // this is authomatically captured and sent to your fyipe dashboard

// capturing error exception manually
try {
    // your code logic
    NonExistingMethodCall();
} catch (error) {
    tracker.captureException(error);
}

// capturing error message
tracker.captureMessage('Message');

API Documentation

Main API to send logs to the server.

Author: HackerBay, Inc.

new FyipeLogger(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. |

new FyipeTracker(apiUrl, errorTrackerId, errorTrackerKey, options)

Create a constructor from the class, which will be used to track events and exceptions to be sent to the server.

Kind: Constructor Returns: null

| Param | Type | Description | | --------------- | ------------------- | --------------------------------------------------- | | apiUrl | string | The Server URL. | | errorTrackerId | string | The Error Tracker ID. | | errorTrackerKey | string | The Error Tracker Key. | | options | object | Set of configuration to be used for error tracking. |

logger.log(log, tags)

Logs a request of type info to the server.

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

| Param | Type | Description | | ----- | ------------------------------------------ | ----------------------------------------------------------- | | log | string | Object | The content to the logged on the server. | | tags | string | Array | The tag(s) to be attached to the logged item on the server. |

logger.warning(log, tags)

Logs a request of type warning to the server.

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

| Param | Type | Description | | ----- | ------------------------------------------ | ----------------------------------------------------------- | | log | string | Object | The content to the logged on the server. | | tags | string | Array | The tag(s) to be attached to the logged item on the server. |

logger.error(log, tags)

Logs a request of type error to the server.

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

| Param | Type | Description | | ----- | ------------------------------------------ | ----------------------------------------------------------- | | log | string | Object | The content to the logged on the server. | | tags | string | Array | The tag(s) to be attached to the logged item on the server. |

tracker.setTag(key, value)

Set a tag for the error to be captured.

Kind: method of new FyipeTracker Returns: null

| Param | Type | Description | | ----- | ------------------- | ---------------------- | | key | string | The key for the tag. | | value | string | The value for thr tag. |

tracker.setTags([{key, value}])

Set an array of tags for the error to be captured.

Kind: method of new FyipeTracker Returns: null

| Param | Type | Description | | ----- | ------------------- | ---------------------- | | key | string | The key for the tag. | | value | string | The value for the tag. |

tracker.setFingerprint(fingerprint)

Set fingerprint for the next error to be captured.

Kind: method of new FyipeTracker Returns: null

| Param | Type | Description | | ----------- | ---------------------------------------------------- | ------------------------------------------------------------- | | fingerprint | string | array of strings | The set of string used to group error messages on the server. |

tracker.addTimeline(category, content, type)

Add a custom timeline element to the next error to be sent to the server

Kind: method of new FyipeTracker Returns: null

| Param | Type | Description | | -------- | ------------------------------------------ | ----------------------------------- | | category | string | The category of the timeline event. | | content | string | Object | The content of the timeline event. | | type | string | The type of timeline event. |

tracker.captureMessage(message)

Capture a custom error message to be sent to the server

Kind: method of new FyipeTracker Returns: null

| Param | Type | Description | | ------- | ------------------- | ------------------------------------- | | message | string | The message to be sent to the server. |

tracker.captureExceptio(error)

Capture a custom error object to be sent to the server

Kind: method of new FyipeTracker Returns: null

| Param | Type | Description | | ----- | ------------------- | ------------------------------------------ | | error | object | The Error Object to be sent to the server. |

Contribution

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