npm install --save sumologic.js
npm run build
npm run watch
npm run test
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);
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',
});
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.
It is possible to attach context to the logs. Here is how to do it:
sumoLogic.context = {
host: http://example.com,
object_id: 22200
};
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
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.