Skip to content

Commit

Permalink
Merge pull request #69 from Logflare/feat/onPreparePayload-callback
Browse files Browse the repository at this point in the history
feat: on prepare payload callback
  • Loading branch information
Ziinc authored Sep 25, 2023
2 parents 4d0de2d + 7847176 commit 92ca7ee
Show file tree
Hide file tree
Showing 11 changed files with 10,658 additions and 783 deletions.
14 changes: 14 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ const writeStream = createWriteStream({
});
```

To customize the payload, use the the `onPreparePayload` option:

```js
const writeStream = createWriteStream({
...,
// optional callback, by default, the received object will be nested under the `metadata` key
onPreparePayload: (payload, meta)=> {
// the `meta` arg contains cleaned information of raw payload
// You can add in top-level keys via this callback, or completely disable `metadata` key nesting by passing the payload as is, as shown below.
return payload
}
});
```

#### apiKey

Type: `String` _(required)_
Expand Down
11 changes: 11 additions & 0 deletions logflare-clients.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"folders": [
{
"path": "."
},
{
"path": "../logflare-transport-core-js"
}
],
"settings": {}
}
Loading

0 comments on commit 92ca7ee

Please sign in to comment.