Unverified Commit 52276143 authored by Hong Minhee's avatar Hong Minhee
Browse files

Upgrade LogTape to 0.8.0

parent 3d98cde5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@ To be released.
     -  Added `FetchKeyOptions` interface.
     -  Added `FetchKeyResult` interface.

 -  The scaffold project generated by `fedify init` command now enables
    tracing data into log messages.


[#162]: https://github.com/dahlia/fedify/issues/162

+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
    "@fedify/fedify/x/hono": "../src/./x/hono.ts",
    "@hongminhee/aitertools": "jsr:@hongminhee/aitertools@^0.6.0",
    "@hugoalh/http-header-link": "jsr:@hugoalh/http-header-link@^1.0.2",
    "@logtape/logtape": "jsr:@logtape/logtape@^0.7.1",
    "@logtape/logtape": "jsr:@logtape/logtape@^0.8.0",
    "@phensley/language-tag": "npm:@phensley/language-tag@^1.9.0",
    "@std/assert": "jsr:@std/assert@^0.226.0",
    "@std/async": "jsr:@std/async@^1.0.5",
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@
    "@hongminhee/localtunnel": "jsr:@hongminhee/localtunnel@^0.2.0",
    "@jimp/core": "npm:@jimp/core@^1.6.0",
    "@jimp/wasm-webp": "npm:@jimp/wasm-webp@^1.6.0",
    "@logtape/logtape": "jsr:@logtape/logtape@^0.7.1",
    "@logtape/logtape": "jsr:@logtape/logtape@^0.8.0",
    "@poppanator/http-constants": "npm:@poppanator/http-constants@^1.1.1",
    "@std/dotenv": "jsr:@std/dotenv@^0.225.2",
    "@std/fs": "jsr:@std/fs@^0.229.3",
+8 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ app.get("/r/0", async (c) => {
        category: ["fedify", "federation", "collection"],
        level: "debug",
        message: ["Fetching followers collection..."],
        rawMessage: "Fetching followers collection...",
        properties: {},
      },
      {
@@ -41,6 +42,7 @@ app.get("/r/0", async (c) => {
          "https://fedify.dev/r/123",
          ".",
        ],
        rawMessage: "Successfully sent activity https://fedify.dev/r/123.",
        properties: {
          activityId: "https://fedify.dev/r/123",
        },
@@ -50,6 +52,7 @@ app.get("/r/0", async (c) => {
        category: ["fedify", "federation", "inbox"],
        level: "warning",
        message: ["Failed to parse activity."],
        rawMessage: "Failed to parse activity.",
        properties: {
          json: await activity.toJsonLd(),
        },
@@ -59,6 +62,7 @@ app.get("/r/0", async (c) => {
        category: ["fedify", "federation", "inbox"],
        level: "error",
        message: ["Failed to parse activity."],
        rawMessage: "Failed to parse activity.",
        properties: {
          json: await activity.toJsonLd(),
        },
@@ -68,6 +72,7 @@ app.get("/r/0", async (c) => {
        category: ["fedify", "federation", "collection"],
        level: "fatal",
        message: ["Something went wrong: ", { foo: 1, bar: 2 }],
        rawMessage: 'Something went wrong: {"foo":1,"bar":2}',
        properties: {},
      },
    ],
@@ -76,6 +81,7 @@ app.get("/r/0", async (c) => {
    <ActivityEntryPage
      idx={idx}
      entry={entry}
      // @ts-ignore:
      tabPage={c.req.query("tab") ?? "request"}
    />,
  );
@@ -93,6 +99,7 @@ app.get("/r/1", (c) => {
    <ActivityEntryPage
      idx={idx}
      entry={entry}
      // @ts-ignore:
      tabPage={c.req.query("tab") ?? "request"}
    />,
  );
@@ -109,6 +116,7 @@ app.get("/r/2", (c) => {
    <ActivityEntryPage
      idx={idx}
      entry={entry}
      // @ts-ignore:
      tabPage={c.req.query("tab") ?? "request"}
    />,
  );
+6 −4
Original line number Diff line number Diff line
@@ -977,8 +977,10 @@ export default federation;
`;
    const logging = `\
import { configure, getConsoleSink } from "@logtape/logtape";
import { AsyncLocalStorage } from "node:async_hooks";

await configure({
  contextLocalStorage: new AsyncLocalStorage(),
  sinks: {
    console: getConsoleSink(),
  },
@@ -986,9 +988,9 @@ await configure({
  loggers: [
    { category: ${
      JSON.stringify(projectName)
    }, level: "debug", sinks: ["console"] },
    { category: "fedify", level: "info", sinks: ["console"] },
    { category: "logtape", level: "warning", sinks: ["console"] },
    }, lowestLevel: "debug", sinks: ["console"] },
    { category: "fedify", lowestLevel: "info", sinks: ["console"] },
    { category: ["logtape", "meta"], lowestLevel: "warning", sinks: ["console"] },
  ],
});
`;
@@ -1031,7 +1033,7 @@ await configure({
    }
    const dependencies: Record<string, string> = {
      "@fedify/fedify": `^${await getLatestFedifyVersion(metadata.version)}`,
      "@logtape/logtape": "^0.4.2",
      "@logtape/logtape": "^0.8.0",
      ...initializer.dependencies,
      ...kvStoreDesc?.dependencies,
      ...mqDesc?.dependencies,
Loading