🚀 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
1
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.8.14

2

dist/index.d.ts

@@ -1,1 +0,1 @@

export { log } from './src/logger';
export { log, LogInput, LogOutput, LogLevels } from './src/logger';

@@ -5,2 +5,3 @@ "use strict";

exports.log = logger_1.log;
exports.LogLevels = logger_1.LogLevels;
//# sourceMappingURL=index.js.map
import { LogInput } from './LogInput';
import { LogLevels } from './logLevels';
import { LogOutput } from './LogOutput';
/**

@@ -35,3 +36,3 @@ * Provides methods for writing logs to in different log-levels. Logs are written in JSON format to stdout using console.log().

}
export declare const log: Logger;
export {};
declare const log: Logger;
export { log, LogLevels, LogInput, LogOutput };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const logLevels_1 = require("./logLevels");
exports.LogLevels = logLevels_1.LogLevels;
/**

@@ -89,3 +90,4 @@ * Provides methods for writing logs to in different log-levels. Logs are written in JSON format to stdout using console.log().

}
exports.log = new Logger();
const log = new Logger();
exports.log = log;
//# sourceMappingURL=logger.js.map
{
"name": "pn-lambda-logger",
"version": "0.8.13",
"version": "0.8.14",
"description": "Logger for AWS Lambda nodejs.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -1,5 +0,40 @@

# A logger for the teams building serverless applications using lambda at PostNord
* Brings a more unified logging format to PN
* Allows the log-pusher to easily parse and ship logs to PN-central logging
* Adds standard log levels
* Makes it easer to to detect and react to error logs that should trigger alarms to sysOps.
# A nodejs logger for AWS Lambda
* Writes logs to stdout using console.log
* Logs in JSON format
* Supports log levels: DEBUG, INFO, WARN, ERROR and OFF
* Defaults to log level INFO
* Built using typescript and includes types
```typescript
import { APIGatewayEvent } from 'aws-lambda';
import { log } from 'pn-lambda-logger';
import { ok } from '../aws/response';
export const healthCheck = async (event: APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {
// Will not show debug messages since default log.level = INFO
log.debug({ message: 'Debug message' });
// Message is mandatory
log.info({ message: 'My message' });
// xRequestId is optional
log.warn({ message: 'My message', xRequestId: 'some-external-id' });
// Context and xRequestId are optional
log.error({ message: 'My message', context, xRequestId: 'some-external-id' });
// Context and xRequestId are optional
log.error({ message: 'My message', context, xRequestId: 'some-external-id', customProp1: 'custom property', customProp2: 42, customProp3: { a: 'more', complex: 'property' } });
cb(null, ok({ status: 'UP' }));
};
```
```typescript
// To show debug messages set level to DEBUG
log.level = LogLevels.DEBUG;
log.debug({ message: 'Debug message' });
};
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet