From 0fa446ceb2d5abcd501232b2e2676069343b2016 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Sat, 21 Feb 2026 22:51:07 +0100 Subject: [PATCH] feat: make Fedify log level configurable via logLevel option Default changed from "info" to "warning" so production logs are quiet. Set logLevel to "info" or "debug" in config to troubleshoot federation. --- CLAUDE.md | 1 + README.md | 1 + index.js | 2 ++ lib/federation-setup.js | 6 +++++- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index f171052..a9d4cb5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -262,6 +262,7 @@ On restart, `refollow:pending` entries are reset to `import` to prevent stale cl redisUrl: "", // Redis for delivery queue (empty = in-process) parallelWorkers: 5, // Parallel delivery workers (with Redis) actorType: "Person", // Person | Service | Organization | Group + logLevel: "warning", // Fedify log level: debug | info | warning | error | fatal timelineRetention: 1000, // Max timeline items (0 = unlimited) } ``` diff --git a/README.md b/README.md index 23b2325..4ff1fa7 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ export default { | `redisUrl` | string | `""` | Redis connection URL for delivery queue | | `parallelWorkers` | number | `5` | Number of parallel delivery workers (requires Redis) | | `actorType` | string | `"Person"` | Actor type: `Person`, `Service`, `Organization`, or `Group` | +| `logLevel` | string | `"warning"` | Fedify log level: `"debug"`, `"info"`, `"warning"`, `"error"`, `"fatal"` | | `timelineRetention` | number | `1000` | Maximum timeline items to keep (0 = unlimited) | ### Redis (Recommended for Production) diff --git a/index.js b/index.js index 3878a88..a380b9e 100644 --- a/index.js +++ b/index.js @@ -82,6 +82,7 @@ const defaults = { redisUrl: "", parallelWorkers: 5, actorType: "Person", + logLevel: "warning", timelineRetention: 1000, notificationRetentionDays: 30, }; @@ -891,6 +892,7 @@ export default class ActivityPubEndpoint { publicationUrl: this._publicationUrl, parallelWorkers: this.options.parallelWorkers, actorType: this.options.actorType, + logLevel: this.options.logLevel, }); this._federation = federation; diff --git a/lib/federation-setup.js b/lib/federation-setup.js index 9ac7074..2be054b 100644 --- a/lib/federation-setup.js +++ b/lib/federation-setup.js @@ -60,6 +60,7 @@ export function setupFederation(options) { publicationUrl = "", parallelWorkers = 5, actorType = "Person", + logLevel = "warning", } = options; // Map config string to Fedify actor class @@ -67,6 +68,9 @@ export function setupFederation(options) { const ActorClass = actorTypeMap[actorType] || Person; // Configure LogTape for Fedify delivery logging (once per process) + // Valid levels: "debug" | "info" | "warning" | "error" | "fatal" + const validLevels = ["debug", "info", "warning", "error", "fatal"]; + const resolvedLevel = validLevels.includes(logLevel) ? logLevel : "warning"; if (!_logtapeConfigured) { _logtapeConfigured = true; configure({ @@ -79,7 +83,7 @@ export function setupFederation(options) { // All Fedify logs — federation, vocab, delivery, HTTP signatures category: ["fedify"], sinks: ["console"], - lowestLevel: "info", + lowestLevel: resolvedLevel, }, ], }).catch((error) => {