-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (26 loc) · 1023 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import repoLink from "../../components/repo-link.js";
export default {
title: "Logging with Edge Functions",
metaDescription: "Output content to the logs from an edge function",
page: function () {
return `
<section>
<h1>Logging with Edge Functions</h1>
<p>You can output content to the logs during the execution of your Edge Function.</p>
<pre><code>import type { Context } from "https://edge.netlify.com";
export default async (request: Request, context: Context) => {
context.log("Hello from the logging service");
};</code></pre>
<h2>See this in action</h2>
<ul>
<li><a href="/log">Echo content to the logs</a></li>
<li>${repoLink("log.ts")}</li>
</ul>
<div class="protip">
<h2>Pro tip!</h2>
<p>You can still use <code>console.log()</code> in your Edge Functions, but using <code>context.log()</code> will tell you which Edge Function generated the message for easier debugging!</p>
</div>
</section>
`;
},
};