GithubHelp home page GithubHelp logo

alphawong / insightops-client Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 1.28 MB

It is a simple insightops js client for both backend and frontend

Home Page: https://www.npmjs.com/package/insightops-client

License: MIT License

JavaScript 100.00%
logentries insightops logger

insightops-client's Introduction

Build Status codecov

objective

As the current official client-side JavaScript logging library for InsightOps do not fit my bussines. I would like to have this pakcage to help.

limition

It only able to send a simple restful based log. Do not support another npm logger winston

install

requirment node 12+ ( current lts @ 2019 )

yarn add insightops-client

example

import { logger } from 'insightops-client'

// expected log @ insightops will be
// {
//   "event": {
//     "message": "hello world",
//     "stringify": "{\"key\":\"value\"}"
//   }
// }
const log = logger('LOG_KEY')
log.info({
  message: 'hello world!!!',
  data: {
    key: 'value'
  }
})

test by ur self

LOG_KEY=uuid npx jest

curl

curl -X POST \
 https://us.js.logs.insight.rapid7.com/v1/logs/YOUR_LOG_TOKLEN \
 -H 'Accept: _/_' \
 -H 'Accept-Encoding: gzip, deflate' \
 -H 'Cache-Control: no-cache' \
 -H 'Connection: keep-alive' \
 -H 'Content-Length: 56' \
 -H 'Content-Type: application/json' \
 -H 'Host: us.js.logs.insight.rapid7.com' \
 -H 'User-Agent: PostmanRuntime/7.19.0' \
 -H 'X-Requested-With: XMLHttpRequest' \
 -H 'cache-control: no-cache' \
 -d '{"event":{"message":"123", "data":"321"},"level":"INFO"}'

about log key

insightops-client's People

Contributors

alphawong avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.