Skip to content

Commit 2790cb9

Browse files
JakeChampionGuy Bedford
andauthored
fix: correct the documentation for the fastly:logger module (#834)
Co-authored-by: Guy Bedford <[email protected]>
1 parent 29361ad commit 2790cb9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

documentation/docs/fastly:logger/Logger/Logger.mdx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import {Fiddle} from '@site/src/components/fiddle';
1010

1111
The **`Logger` constructor** lets you connect your Fastly Compute application to a [Fastly Named Logger](https://developer.fastly.com/learning/integrations/logging/).
1212

13-
**Note**: Can only be used when processing requests, not during build-time initialization.
14-
1513
## Syntax
1614

1715
```js
@@ -24,7 +22,7 @@ new Logger(name)
2422

2523
- `name` _: string_
2624
- The Fastly Logger which should be associated with this Logger instance
27-
25+
2826
### Return value
2927

3028
A new `Logger` object.
@@ -40,7 +38,7 @@ In this example we have a create a logger named `"splunk"` and logs the incoming
4038
"https://http-me.glitch.me"
4139
],
4240
"src": {
43-
"deps": "{\n \"@fastly/js-compute\": \"^1.0.1\"\n}",
41+
"deps": "{\n \"@fastly/js-compute\": \"^3\"\n}",
4442
"main": `
4543
/// <reference types="@fastly/js-compute" />
4644
import { Logger } from "fastly:logger";
@@ -74,8 +72,8 @@ addEventListener("fetch", event => event.respondWith(app(event)));
7472
```js
7573
/// <reference types="@fastly/js-compute" />
7674
import { Logger } from "fastly:logger";
75+
const logger = new Logger("splunk");
7776
async function app (event) {
78-
let logger = new Logger("splunk");
7977
logger.log(JSON.stringify({
8078
method: event.request.method,
8179
url: event.request.url

documentation/docs/fastly:logger/Logger/prototype/log.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {Fiddle} from '@site/src/components/fiddle';
1212

1313
Sends the given message, converted to a string, to this Logger instance's endpoint.
1414

15+
**Note**: Can only be used when processing requests, not during build-time initialization.
16+
1517
## Syntax
1618

1719
```js
@@ -41,12 +43,12 @@ In this example we have a create a logger named `"splunk"` and logs the incoming
4143
"https://http-me.glitch.me"
4244
],
4345
"src": {
44-
"deps": "{\n \"@fastly/js-compute\": \"^1.0.1\"\n}",
46+
"deps": "{\n \"@fastly/js-compute\": \"^3\"\n}",
4547
"main": `
4648
/// <reference types="@fastly/js-compute" />
4749
import { Logger } from "fastly:logger";
50+
let logger = new Logger("splunk");
4851
async function app (event) {
49-
let logger = new Logger("splunk");
5052
logger.log(JSON.stringify({
5153
method: event.request.method,
5254
url: event.request.url

0 commit comments

Comments
 (0)