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

errorlens-sdk

v0.0.111

Published

## Overview ErrorLens SDK is a JavaScript library designed to capture and report errors in your web applications. It's built to be used with our error monitoring service, offering both free and subscription-based options. We also provide a basic open-sour

Downloads

302

Readme

ErrorLens SDK

Overview

ErrorLens SDK is a JavaScript library designed to capture and report errors in your web applications. It's built to be used with our error monitoring service, offering both free and subscription-based options. We also provide a basic open-source backend that can be self-hosted, while paid subscriptions unlock additional features and support.

Installation

To install the ErrorLens SDK, use npm:

npm install errorlens-sdk

Usage

Initialization

To initialize the ErrorLens SDK in your project, use the following code:

const ErrorLens = require('./src/index')({
  sdk: "<YOUR_SDK_KEY>",
  host: "<TEAM_NAME>.teams.errorlens.com",
});
ErrorLens.addContext({
  appName: 'My Browser App',
  version: '1.0.0',
  environment: 'production',
});
ErrorLens.init();
ErrorLens.wrapConsole();

Capturing Errors

To capture errors manually, use the captureError function:

ErrorLens.captureError(new Error('This is a test error'));

Building the Project

To build the project, use the following npm script:

npm run build

This will bundle your source files into dist/error-lens.bundle.js.

Example

Here is an example of how to use the ErrorLens SDK in a web project:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>ErrorLens Demo</title>
</head>
<body>
  <button onclick="throwError()">Click me</button>
  <script src="dist/error-lens.bundle.js"></script>
  <script>
    // Initialize ErrorLens with your SDK key and team name
    const errorLens = ErrorLens({
	    sdk: "<YOUR_SDK_KEY>",
	    host: "<TEAM_NAME>.teams.errorlens.com"
    });

    // Add context information - in the future, this will be set on the dashboard for each project sdk-key.
    errorLens.addContext({
	    appName: 'My Browser App',
	    version: '1.0.0',
	    environment: 'production'
    });

    // Initialize ErrorLens
    errorLens.init();

    // Wrap console functions to capture errors
    errorLens.wrapConsole();

    // This error will be reported to the ErrorLens dashboard
    function throwError() {
      throw new Error("Button click error");
    }
  </script>
</body>
</html>

Example of how to use the ErrorLens SDK in a Node.js project:

const ErrorLens = require('./src/index')({
  sdk: "<YOUR_SDK_KEY>",
  host: "<TEAM_NAME>.teams.errorlens.com"
});

ErrorLens.addContext({
  appName: 'My Browser App',
  version: '1.0.0',
  environment: 'production',
});

ErrorLens.init();
ErrorLens.wrapConsole();

throw new Error("This is a test error");

Contributing

We welcome contributions to the ErrorLens SDK. To contribute, please follow these steps:

  1. Fork the repository
  2. Create a new branch
  3. Make your changes
  4. Test your changes
  5. Submit a pull request
  6. Wait for approval
  7. Merge your changes
  8. Celebrate!

Support

COMMUNITY-SUPPORT (AT) ERRORLENS (DOT) COM is a dedicated email address for community support. Please feel free to reach out with any questions or concerns. Alternatively, you can open an issue on GitHub.

License

This project is licensed under the MIT License.