Skip to content

Commit e5b1119

Browse files
authored
feat!: ignore lambda environments (#10)
* feat!: ignore lambda environment for simpler testing When running this package under test, it required you to set the AWS_EXECUTION_ENV variable. Since we now protect against undefined or null values, we no longer need to check the execution environment. * chore: update PR check action version
1 parent b418ebb commit e5b1119

File tree

3 files changed

+1
-8
lines changed

3 files changed

+1
-8
lines changed

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-18.04
88
steps:
99
- name: Check Commits
10-
uses: amannn/action-semantic-pull-request@v3.1.0
10+
uses: amannn/action-semantic-pull-request@v3.4.0
1111
env:
1212
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1313

src/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ const CORRELATION_ID = `${CORRELATION_HEADER}id`;
3333
const CORRELATION_TRACE_ID = `${CORRELATION_HEADER}trace-id`;
3434
const CORRELATION_DEBUG = `${CORRELATION_HEADER}debug`;
3535

36-
const isLamdbaExecution = (): boolean => !!process.env.AWS_EXECUTION_ENV;
3736
const formatLevel = (level: string | number, levels: LevelMapping): string => {
3837
if (typeof level === 'string') {
3938
return level.toLocaleUpperCase();
@@ -84,10 +83,6 @@ export type PinoLambdaLogger = Logger & {
8483
* that provides convinience methods for use with AWS Lambda
8584
*/
8685
export default (extendedPinoOptions?: ExtendedPinoOptions): PinoLambdaLogger => {
87-
if (!isLamdbaExecution()) {
88-
return (pino(extendedPinoOptions) as unknown) as PinoLambdaLogger;
89-
}
90-
9186
const options = extendedPinoOptions ?? {};
9287
const storageProvider = extendedPinoOptions?.storageProvider || GlobalContextStorageProvider;
9388

src/tests/index.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import tap from 'tap';
22
import sinon from 'sinon';
33
import pino, { PinoLambdaLogger, ExtendedPinoOptions } from '../index';
44

5-
process.env.AWS_EXECUTION_ENV = 'AWS_Lambda_nodejs14';
65
sinon.useFakeTimers(Date.UTC(2016, 11, 1, 6, 0, 0, 0));
76

87
tap.test('should log a simple info message', (t) => {
@@ -98,7 +97,6 @@ tap.test('should capture xray trace IDs', (t) => {
9897
t.end();
9998
});
10099

101-
102100
/**
103101
* Creates a test logger and output buffer for assertions
104102
* Returns the logger and the buffer

0 commit comments

Comments
 (0)