Skip to content

Commit

Permalink
Add debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ikemsley committed Jan 22, 2018
1 parent ec1706c commit 3df6ed2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,24 @@ lambda function into a zip file.

Please use the following [code style](https://github.com/airbnb/javascript) as much as possible.

# Debugging

To get a debug trace, set an Node.js environment variable called DEBUG and
specify the JavaScript module/s to debug.

E.g.

```
export DEBUG=*
export DEBUG=index
```

Or set an environment variable called "DEBUG" in your AWS stack (using the AWS
console) for the "alertlogic-cwe-collector" AWS Lambda function, with
value "index" or "*".

See [debug](https://www.npmjs.com/package/debug) for further details.

# Known Issues/ Open Questions

- TBD.
Expand Down
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* -----------------------------------------------------------------------------
*/

const debug = require('debug') ('index');
const https = require('https');
const util = require('util');
const AWS = require('aws-sdk');
Expand All @@ -19,6 +20,7 @@ const m_alServiceC = require('./lib/al_servicec');
const m_alAws = require('./lib/al_aws');
const m_checkin = require('./checkin');
const m_packageJson = require('./package.json');
const m_alUtil = require('./lib/al_util');

const response = require('cfn-response');

Expand Down Expand Up @@ -305,6 +307,7 @@ function getStatistics(context, event, finalCallback) {


exports.handler = function(event, context) {
debug("DEBUG0001: Received event: ", JSON.stringify(event));
switch (event.RequestType) {
case 'ScheduledEvent':
return processScheduledEvent(event, context);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"sinon": "^3.3.0"
},
"dependencies": {
"debug": "*",
"async": "*",
"cfn-response": "*",
"moment": "^2.19.2",
Expand Down

0 comments on commit 3df6ed2

Please sign in to comment.