🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

pn-lambda-logger

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pn-lambda-logger - npm Package Compare versions

Comparing version

to
0.12.0

dist/src/prettyPrint.d.ts

53

dist/src/logger.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const prettyPrint_1 = require("./prettyPrint");
const logLevels_1 = require("./types/logLevels");

@@ -41,3 +42,3 @@ exports.LogLevels = logLevels_1.LogLevels;

let log = this.createLogJson(logInput, logLevels_1.LogLevels.DEBUG);
console.log(JSON.stringify(log, null, 2));
console.log(prettyPrint_1.prettyPrint(log));
}

@@ -56,3 +57,3 @@ }

let log = this.createLogJson(logInput, logLevels_1.LogLevels.INFO);
console.log(JSON.stringify(log, null, 2));
console.log(prettyPrint_1.prettyPrint(log));
}

@@ -71,3 +72,3 @@ }

let log = this.createLogJson(logInput, logLevels_1.LogLevels.WARN);
console.log(JSON.stringify(log, null, 2));
console.log(prettyPrint_1.prettyPrint(log));
}

@@ -92,3 +93,3 @@ }

let log = this.createLogJson(logInput, logLevels_1.LogLevels.ERROR);
console.log(JSON.stringify(log, null, 2));
console.log(prettyPrint_1.prettyPrint(log));
}

@@ -128,8 +129,20 @@ }

logOutput.message = logInput.message;
logOutput.xRequestId = this.xRequestId;
logOutput.host = this.host;
logOutput.verb = this.verb;
logOutput.path = this.path;
logOutput.useragent = this.useragent;
logOutput.query = this.query;
if (this.xRequestId) {
logOutput.xRequestId = this.xRequestId;
}
if (this.host) {
logOutput.host = this.host;
}
if (this.verb) {
logOutput.verb = this.verb;
}
if (this.path) {
logOutput.path = this.path;
}
if (this.useragent) {
logOutput.useragent = this.useragent;
}
if (this.query) {
logOutput.query = this.query;
}
/**

@@ -139,7 +152,17 @@ * By using the lambda context we can easily add more rich logging.

if (context) {
logOutput.awsRequestId = context.awsRequestId ? context.awsRequestId : undefined;
logOutput.functionName = context.functionName ? context.functionName : undefined;
logOutput.invokedFunctionArn = context.invokedFunctionArn ? context.invokedFunctionArn : undefined;
logOutput.memoryLimitInMB = context.memoryLimitInMB ? context.memoryLimitInMB : undefined;
logOutput.remainingTime = context.getRemainingTimeInMillis ? context.getRemainingTimeInMillis() : undefined;
if (context.awsRequestId) {
logOutput.awsRequestId = context.awsRequestId;
}
if (context.functionName) {
logOutput.functionName = context.functionName;
}
if (context.invokedFunctionArn) {
logOutput.invokedFunctionArn = context.invokedFunctionArn;
}
if (context.memoryLimitInMB) {
logOutput.memoryLimitInMB = context.memoryLimitInMB;
}
if (context.getRemainingTimeInMillis) {
logOutput.remainingTime = context.getRemainingTimeInMillis();
}
}

@@ -146,0 +169,0 @@ for (let prop of Object.keys(logInput)) {

{
"name": "pn-lambda-logger",
"version": "0.11.0",
"version": "0.12.0",
"description": "Logger for AWS Lambda nodejs.",

@@ -21,9 +21,16 @@ "main": "dist/index.js",

"homepage": "https://bitbucket.org/avupublicapis/pn-lambda-logger#readme",
"dependencies": {},
"dependencies": {
"chalk": "^2.4.2"
},
"devDependencies": {
"@types/ansi-regex": "^4.0.0",
"@types/ansi-styles": "^3.2.1",
"@types/aws-lambda": "8.10.14",
"@types/chai": "4.1.5",
"@types/common-tags": "^1.8.0",
"@types/mocha": "5.2.5",
"@types/node": "10.11.2",
"ansi-styles": "^4.1.0",
"chai": "4.2.0",
"common-tags": "^1.8.0",
"mocha": "5.2.0",

@@ -30,0 +37,0 @@ "nyc": "13.3.0",

@@ -6,2 +6,3 @@ # A nodejs logger for AWS Lambda

* Defaults to log level INFO
* Support for [pretty print](#pretty-print) when debugging
* Built using typescript and includes types

@@ -123,2 +124,13 @@

## Pretty print
You can improve the appearance of logs when debugging, to make them easier to read. This will also add color to your logs
if your terminal supports it.
To use, set the `PN_LOG_PRETTY` environment variable.
```bash
export PN_LOG_PRETTY=true
```
## Mute all logs:

@@ -133,2 +145,30 @@ ```typescript

PN_LOG_LEVEL: 'DEBUG'
```
```
## Release process
When you are ready to release a version, take the following steps.
1. Bump the `version` in `package.json` according to [semver](https://semver.org/spec/v2.0.0.html). If we are making a
non-breaking change, compared to the last version, the new `version` would be `0.12.0`.
`"version": "0.11.0",` to `"version": "0.12.0"`
2. Make a commit titled "Release `version`":
```bash
git commit -m "Release 0.12.0"
```
3. Tag your commit with the `version`, this is what triggers the deployment in Bitbucket Pipelines.
The tagged commit must start with `release-`
```bash
git tag -a "release-0.12.0" -m "Release 0.12.0"
```
4. Push to master!
```bash
git push --follow-tags
```

Sorry, the diff of this file is not supported yet