Skip to content

Commit

Permalink
chore: add additional option to populate http request metadata (#1191)
Browse files Browse the repository at this point in the history
* chore: add additional option to populate http request metadata

Fixes #1129

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
minherz and gcf-owl-bot[bot] authored Dec 13, 2021
1 parent c4abb7e commit de40c6d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .readme-partials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@ body: |-
log.alert(entry);
log.warning(entry);
```
## Populating Http request metadata
Metadata about Http request is a part of the [structured log info](https://cloud.google.com/logging/docs/structured-logging)
that can be captured within each log entry. It can provide a context for the application logs and
is used to group multiple log entries under the load balancer request logs. See the [sample](https://github.com/googleapis/nodejs-logging/blob/master/samples/http-request.js)
how to populate the Http request metadata for log entries.
If you already have a "raw" Http `request` object you can assign it to `entry.metadata.httpRequest` directly. More information about
how the `request` is interpreted as raw can be found in the [code](https://github.com/googleapis/nodejs-logging/blob/15849160116a814ab71113138cb211c2e0c2d4b4/src/entry.ts#L224-L238).
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@ log.alert(entry);
log.warning(entry);
```
## Populating Http request metadata
Metadata about Http request is a part of the [structured log info](https://cloud.google.com/logging/docs/structured-logging)
that can be captured within each log entry. It can provide a context for the application logs and
is used to group multiple log entries under the load balancer request logs. See the [sample](https://github.com/googleapis/nodejs-logging/blob/master/samples/http-request.js)
how to populate the Http request metadata for log entries.
If you already have a "raw" Http `request` object you can assign it to `entry.metadata.httpRequest` directly. More information about
how the `request` is interpreted as raw can be found in the [code](https://github.com/googleapis/nodejs-logging/blob/15849160116a814ab71113138cb211c2e0c2d4b4/src/entry.ts#L224-L238).
## Samples
Expand Down

0 comments on commit de40c6d

Please sign in to comment.