Coder Social home page Coder Social logo

sumologic.js's Introduction

sumologic.js

Installation

npm install --save sumologic.js

Build the module

npm run build

Run the build process locally

npm run watch

Run the specs

npm run test


Usage

You need to import SumoLogic module: import SumoLogic from 'sumologic.js';

const settings = {
  endpoint: "{your Sumo Logic http endpoint}",
  captureConsole: true,
  captureError: true,
  devMode: false,
};

const sumoLogic = new SumoLogic(settings);

methods

To log an info message

sumoLogic.info({
  message: 'message',
  any: 'object',
});

To log an error message

sumoLogic.error({
  message: 'message',
  any: 'object',
});

To log a warning message:

sumoLogic.warn({
  message: 'message',
  any: 'object',
});

Settings:

endpoint (mandatory) provided by SumoLogic when you create an HTTP collection

syncInterval (optional - 3000ms by default) is the frequency we're sending the logs to SumoLogic.

captureConsole (optional - true by default). To send console logs to SumoLogic; it includes ('warn', 'info', 'log', 'error').

captureError (optional - true by default). To send runtime errors to SumoLogic.

devMode (optional - false by default). To disable sending logs to the server, typically used to disable logging in development mode.

Context

It is possible to attach context to the logs. Here is how to do it:

sumoLogic.context = {
  host: http://example.com,
  object_id: 22200
};

Additional methods

SumoLogic.dump() dump all the logs that are not sent yet to SumoLogic. One use case for this is when you need to make sure all the logs are sent before closing your application.

sumologic.js's People

Contributors

imouaddine avatar

Stargazers

 avatar Monji Dolon avatar Bozhao avatar

Watchers

Scott Russell avatar Chris Sloan avatar Espen Volden avatar Gabe Kessler avatar Paul Hepworth avatar  avatar Blake Hall avatar jblythe avatar Diane Cessna avatar Monji Dolon avatar  avatar Kingsley avatar Johann Verghese avatar James Cloos avatar Amy Hirschbeck avatar Homer Gaines, CPACC avatar Perry Lee avatar Malak avatar Jesse Jones avatar Ron Bellido avatar Eric avatar Daniele Hohol avatar Doug avatar Kilimanjaro avatar Harsh Patel avatar Sakif Imtiaz avatar Boshra Nabaei avatar Eric Rabinowitz avatar Luke Lewis avatar Albert Agram avatar Derrick Schippert avatar Eli Riter avatar Mike Neff avatar Sagar Podilapu avatar Darren Wong avatar Brian Pohuski avatar Blair Fraser avatar Kristijan Ivancic avatar  avatar Michelle Cacais avatar Aravind Sagar avatar  avatar Ross Williams avatar SHIYAO avatar Angad Chandorkar avatar Brandon Case avatar Arran Rashid avatar Fraser avatar Zachary Lawson avatar  avatar JP Poriz avatar Kien Nguyen avatar Bryan Dong avatar  avatar Zack Mariscal avatar Jordi Batet avatar Rashad avatar Ridge Frederick avatar Brooklyn Copeland avatar Neja Cesnik avatar  avatar Waleola Akinsanmi avatar Ali Azadeh avatar Philip Solobay avatar Kevin Kurtz avatar Shiva Thavamani avatar Wiktor Karpinski avatar  avatar Christine G avatar  avatar  avatar Màrius Duch avatar Guillem Aldeguer Lima avatar Ivan Mina avatar Sergi Rosell avatar Léon Hollender avatar Bryan Dong avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.