Skip to content

Commit 1d84f08

Browse files
fix: adding contributing guidelines (#42)
1 parent f626f3e commit 1d84f08

File tree

2 files changed

+130
-18
lines changed

2 files changed

+130
-18
lines changed

CONTRIBUTING.MD

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
Thank you for contributing!
2+
3+
## Development
4+
5+
### Installing dependencies
6+
7+
```sh
8+
yarn install
9+
```
10+
11+
### Testing
12+
13+
You will find tests for files colocated with `*.test.ts` suffixes. Whenever making any changes, ensure that all existing tests pass by running `yarn test`.
14+
15+
If you are adding a new feature or some extra functionality, you should also make sure to accompany those changes with appropriate tests.
16+
17+
### Linting and Formatting
18+
19+
Before committing any changes, be sure to do `yarn lint`; this will lint all relevant files using [ESLint](http://eslint.org/) and report on any changes that you need to make.
20+
21+
### Before submitting a PR...
22+
23+
Thanks for taking the time to help us make pino-lambda even better! Before you go ahead and submit a PR, make sure that you have done the following:
24+
25+
- Run the tests using `yarn test`.
26+
- Run lint and flow using `yarn lint`
27+
- Ensure your branch and commit message conform to the [`semantic-release`](https://github.com/semantic-release/semantic-release#commit-message-format) format
28+
29+
### Semantic-Release
30+
31+
We use [`semantic-release`](https://github.com/semantic-release/semantic-release) to create package versions and publish them.
32+
33+
Ensure your branch name and commit message format conform to the [`semantic-release`](https://github.com/semantic-release/semantic-release#commit-message-format) format before submitting your PR.
34+
35+
When completed successfully, a `semantic-release` message will be added to your merged PR, with a link to the NPM Package and GitHub Release.
36+
37+
## Contributor Covenant Code of Conduct
38+
39+
### Our Pledge
40+
41+
In the interest of fostering an open and welcoming environment, we as
42+
contributors and maintainers pledge to making participation in our project and
43+
our community a harassment-free experience for everyone, regardless of age, body
44+
size, disability, ethnicity, gender identity and expression, level of experience,
45+
nationality, personal appearance, race, religion, or sexual identity and
46+
orientation.
47+
48+
### Our Standards
49+
50+
Examples of behavior that contributes to creating a positive environment
51+
include:
52+
53+
- Using welcoming and inclusive language
54+
- Being respectful of differing viewpoints and experiences
55+
- Gracefully accepting constructive criticism
56+
- Focusing on what is best for the community
57+
- Showing empathy towards other community members
58+
59+
Examples of unacceptable behavior by participants include:
60+
61+
- The use of sexualized language or imagery and unwelcome sexual attention or
62+
advances
63+
- Trolling, insulting/derogatory comments, and personal or political attacks
64+
- Public or private harassment
65+
- Publishing others' private information, such as a physical or electronic
66+
address, without explicit permission
67+
- Other conduct which could reasonably be considered inappropriate in a
68+
professional setting
69+
70+
### Our Responsibilities
71+
72+
Project maintainers are responsible for clarifying the standards of acceptable
73+
behavior and are expected to take appropriate and fair corrective action in
74+
response to any instances of unacceptable behavior.
75+
76+
Project maintainers have the right and responsibility to remove, edit, or
77+
reject comments, commits, code, wiki edits, issues, and other contributions
78+
that are not aligned to this Code of Conduct, or to ban temporarily or
79+
permanently any contributor for other behaviors that they deem inappropriate,
80+
threatening, offensive, or harmful.
81+
82+
### Scope
83+
84+
This Code of Conduct applies both within project spaces and in public spaces
85+
when an individual is representing the project or its community. Examples of
86+
representing a project or community include using an official project e-mail
87+
address, posting via an official social media account, or acting as an appointed
88+
representative at an online or offline event. Representation of a project may be
89+
further defined and clarified by project maintainers.
90+
91+
### Enforcement
92+
93+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
94+
reported by contacting the project team at emma.brillhart@formidable.com. All
95+
complaints will be reviewed and investigated and will result in a response that
96+
is deemed necessary and appropriate to the circumstances. The project team is
97+
obligated to maintain confidentiality with regard to the reporter of an incident.
98+
Further details of specific enforcement policies may be posted separately.
99+
100+
Project maintainers who do not follow or enforce the Code of Conduct in good
101+
faith may face temporary or permanent repercussions as determined by other
102+
members of the project's leadership.
103+
104+
### Attribution
105+
106+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
107+
available at [http://contributor-covenant.org/version/1/4][version]
108+
109+
[homepage]: http://contributor-covenant.org
110+
[version]: http://contributor-covenant.org/version/1/4/

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ import { lambdaRequestTracker, pinoLambdaDestination } from 'pino-lambda';
2525

2626
// custom destination formatter
2727
const destination = pinoLambdaDestination();
28-
const logger = pino({
29-
// typical pino options
30-
}, destination);
28+
const logger = pino(
29+
{
30+
// typical pino options
31+
},
32+
destination,
33+
);
3134
const withRequest = lambdaRequestTracker();
3235

3336
async function handler(event, context) {
@@ -60,13 +63,13 @@ other Cloudwatch aware tools such as Datadog and Splunk.
6063

6164
With context tracing enabled, all instances of `pino` that use one of the built in formatters will automatically log the request id and other details so you don't need to pass an instance of a logger to all of your functions.
6265

63-
| Property | Value | Info |
64-
| ------------------------- | ------------------------------------------ | ------------------------------------------------------------------------ |
65-
| awsRequestId | context.awsRequestId | The unique request id for this request |
66-
| apiRequestId | context.requestContext.requestId | The API Gateway RequestId |
67-
| x-correlation-id | event.headers['x-correlation-id'] | The upstream request id for tracing |
68-
| x-correlation-trace-id | process.env._X_AMZN_TRACE_ID | The AWS Xray tracking id |
69-
| x-correlation-\* | event.headers.startsWith('x-correlation-') | Any header that starts with `x-correlation-` will be automatically added |
66+
| Property | Value | Info |
67+
| ---------------------- | ------------------------------------------ | ------------------------------------------------------------------------ |
68+
| awsRequestId | context.awsRequestId | The unique request id for this request |
69+
| apiRequestId | context.requestContext.requestId | The API Gateway RequestId |
70+
| x-correlation-id | event.headers['x-correlation-id'] | The upstream request id for tracing |
71+
| x-correlation-trace-id | process.env.\_X_AMZN_TRACE_ID | The AWS Xray tracking id |
72+
| x-correlation-\* | event.headers.startsWith('x-correlation-') | Any header that starts with `x-correlation-` will be automatically added |
7073

7174
Every AWS Lambda request contains a unique request ID, `context.awsRequestId`. If the request originated outside of the AWS platform,
7275
the request ID will match the `event.header.x-correlation-id` value. However, if the request originated from within the AWS platform,
@@ -77,7 +80,7 @@ Amazon XRAY also has a unique tracing ID that is propagated across the requests
7780

7881
## Customize request tracing
7982

80-
You can customize the data that is tracked for each request by adding a per-request mixin.
83+
You can customize the data that is tracked for each request by adding a per-request mixin.
8184
The request mixin takes the Lambda `event` and `context` and returns an object.
8285

8386
This differs from the built in [pino mixin](https://github.com/pinojs/pino/blob/master/docs/api.md#mixin-function) as it only executes
@@ -100,9 +103,9 @@ const withRequest = lambdaRequestTracker({
100103
'x-correlation-id': undefined,
101104

102105
// add any type of static data
103-
brand: 'famicom'
106+
brand: 'famicom',
104107
};
105-
}
108+
},
106109
});
107110

108111
async function handler(event, context) {
@@ -132,11 +135,7 @@ By default, the `pinoLambdaDestination` uses the `CloudwatchLogFormatter`. If yo
132135

133136
```ts
134137
import pino from 'pino';
135-
import {
136-
lambdaRequestTracker,
137-
pinoLambdaDestination,
138-
PinoLogFormatter
139-
} from 'pino-lambda';
138+
import { lambdaRequestTracker, pinoLambdaDestination, PinoLogFormatter } from 'pino-lambda';
140139

141140
const destination = pinoLambdaDestination({
142141
formatter: new PinoLogFormatter(),
@@ -226,6 +225,9 @@ async function handler(event, context) {
226225

227226
You can use the this wrapper outside of the AWS lambda function in any place you want. This is especially useful in private npm modules that will be used by your AWS Lambda function. The default logger context is a shared instance, so it inherits all properties the default is configured for, and will emit request information for all logs. This effectively allows you to track a request across its entire set of log entries.
228227

228+
## Contributing
229+
230+
Please see our [contributing guide](CONTRIBUTING.md).
229231

230232
## Maintenance Status
231233

0 commit comments

Comments
 (0)