Skip to main content
Version: 3.3.0


The Logger constructor lets you connect your Fastly Compute application to a Fastly Named Logger.

Note: Can only be used when processing requests, not during build-time initialization.


new Logger(name)

Note: Logger() can only be constructed with new. Attempting to call it without new throws a TypeError.


  • name : string
    • The Fastly Logger which should be associated with this Logger instance

Return value

A new Logger object.


In this example we have a create a logger named "splunk" and logs the incoming request method and destination.

/// <reference types="@fastly/js-compute" />
import { Logger } from "fastly:logger";
async function app (event) {
let logger = new Logger("splunk");
method: event.request.method,
url: event.request.url

return new Response('OK');
addEventListener("fetch", event => event.respondWith(app(event)));