@vigilant-js/core
v1.0.11
Published
Base package for all Vigilant JS packages
Readme
Vigilant Core
This is the core library for Vigilant (https://vigilant.run).
Installation
npm install @vigilant-js/coreGenerate a token
You can generate a token by going to the Vigilant Dashboard and clicking the "Create Token" button.
Usage (Logging)
Vigilant automatically captures console statements and sends them to the Vigilant API. You can also log messages with the logging functions directly.
import { initVigilant, logInfo } from '@vigilant-js/core'
initVigilant({
name: 'backend',
token: 'generated-token-here',
})
console.log('Hello, world!')
logInfo('Hello, world!')Usage (Alerting)
Vigilant allows you to create alerts for specific events. You will get notified when an alert is created.
import { initVigilant, createAlert } from '@vigilant-js/core'
initVigilant({
name: 'backend',
token: 'generated-token-here',
})
createAlert('db query failed', {
query: 'SELECT * FROM users',
error: 'Syntax error',
})