https://github.com/iopipe/iopipe-js-logger
Automatic console data into IOpipe
https://github.com/iopipe/iopipe-js-logger
analytics logging
Last synced: 5 months ago
JSON representation
Automatic console data into IOpipe
- Host: GitHub
- URL: https://github.com/iopipe/iopipe-js-logger
- Owner: iopipe
- License: apache-2.0
- Created: 2018-05-10T00:41:19.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-16T15:50:54.000Z (over 6 years ago)
- Last Synced: 2024-11-22T17:55:38.768Z (6 months ago)
- Topics: analytics, logging
- Language: JavaScript
- Homepage: https://www.iopipe.com
- Size: 95.7 KB
- Stars: 2
- Watchers: 5
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IOpipe JS Logger Plugin
[](https://badge.fury.io/js/%40iopipe%2Flogger)
[](https://github.com/prettier/prettier)
[](https://github.com/semantic-release/semantic-release)This is a logging plugin for use with [IOpipe](https://iopipe.com) and AWS Lambda. Automatically records output from `console` for viewing in the IOpipe dashboard.
## Installation
With [yarn](https://yarnpkg.com/) (recommended) in project directory:
`yarn add @iopipe/logger`
With npm in project directory:
`npm install @iopipe/logger`
Then include the plugin with IOpipe in your serverless function:
```js
const iopipeLib = require('@iopipe/iopipe');
const logger = require('@iopipe/logger');const iopipe = iopipeLib({
token: process.env.IOPIPE_TOKEN,
plugins: [logger({ enabled: true })]
});exports.handler = iopipe(async (event) => {
console.log('This will show up in IOpipe!');
// supported methods include log, debug, info, warn, error, and dir
return 'Hello world!'
});
```## Config
#### `enabled` (bool: optional = false)
By default, this plugin is disabled. To automatically record output of calls to `console`, set this value to `true`. You can also use an environment variable like this: `IOPIPE_LOGGER_ENABLED=true`.
#### `networkTimeout` (number: optional = 5000)
Network timeout for uploading logs to IOpipe.
## License
Apache-2.0 see [LICENSE](https://www.apache.org/licenses/LICENSE-2.0.html)
Copyright 2018, IOpipe, Inc.