0.1.3-beta • Published 6 years ago

errlog.io-webhook v0.1.3-beta

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
6 years ago

errlog.io-webhook

An beta version NodeJs module to the errlog.io webhook.

Install

For Node:

Add the following to your package.json file under dependencies:

npm install errlog.io-webhook

Import

import {ErrLogIo} from 'errlog.io-webhook';
const errLogIo = ErrLogIo('my-errlog.io-API-key');

Use

errLogIo.send({message: 'The penguins are escaping!', applicationname: 'my-shiny-new-app'});

Payload Variables

An exhaustive and up-to-date list of payload variables can be found here: https://errlog.io/docs/webhook-api

At the time of writing, the following list of variables were available:

VariableTypeRequiredDescription
apikeystringrequiredThis is your ErrLog.IO apikey.
messagedynamicrequiredThis is the error message that you want logged.
typedynamicrecommendedThis is the type of event you're logging. In C# it could be "NullReferenceException", "ArgumentException" or just "Exception".
applicationnamedynamicrecommendedThis is the name of the application that caused the event. Helpful for distinguishing different applications.
errordatedynamicoptionalThe datetime the event occurred. Should be in the format yyyy-mm-dd hh:mm:ss where specified.
querystringdynamicoptionalThe querystring of the request which caused the event.
tracedynamicoptionalThis is the stacktrace of the exception.
pagedynamicoptionalThis is the page in which the event occurred
methoddynamicoptionalThis is the method in which the event occurred
linenointoptionalThe line number of the code which caused the event.
colnointoptionalThe column number of the code which caused the event.
filenamedynamicoptionalThe filename of the code which caused the event.
useragentdynamicoptionalThis is the useragent string for the client's browser
browsernamedynamicoptionalThis is the browser the client was using when the event occurred.
servernamedynamicoptionalThis is an identifier for the server/device on which the event occurred.
browser_capabilitiesdynamicoptionalThis is identifies the capabilities of the client's browser
ipaddressdynamicoptionalThis is the IP address of the client device.
customdynamicoptionalThis can be used to store any additional data you want.
languagedynamicoptionalThis is the programming language the code was written in.
session_datadynamicoptionalRepresents a HttpSessionState object.
assemblyversiondynamicoptionalYou can use this to represent the version of your application/library.
application_datadynamicoptionalUsed to store name/value data from your Application state.
request_headerdynamicoptionalThis is used to store the HTTP Request Headers as name/value pairs.
request_formdatadynamicoptionalThis is used to store the HTTP Request Form Data as name/value pairs.
request_cookiesdynamicoptionalThis is used to store the HTTP Cookies as name/value pairs.
environmentdynamicoptionalThis is used to store general environment metrics as name/value pairs.

Test

Testing the end-point requires a valid API for some of the tests. You may specify this as a single line in a file located in the root of this project named: TESTING_ERRLOGIO_API_KEY

e.g.

cd errlog.io-webhook repository root
cat "my-errlog.io-api-key" > ./TESTING_ERRLOGIO_API_KEY

Running the test is straightforward:

npm test

If developing tests/TDD, you can watch for changes and run the tests after each change automatically.

npm run test:watch