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.
This commit is contained in:
Ricardo
2026-02-21 22:51:07 +01:00
parent 52088a7bce
commit 0fa446ceb2
4 changed files with 9 additions and 1 deletions
+1
View File
@@ -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) redisUrl: "", // Redis for delivery queue (empty = in-process)
parallelWorkers: 5, // Parallel delivery workers (with Redis) parallelWorkers: 5, // Parallel delivery workers (with Redis)
actorType: "Person", // Person | Service | Organization | Group actorType: "Person", // Person | Service | Organization | Group
logLevel: "warning", // Fedify log level: debug | info | warning | error | fatal
timelineRetention: 1000, // Max timeline items (0 = unlimited) timelineRetention: 1000, // Max timeline items (0 = unlimited)
} }
``` ```
+1
View File
@@ -93,6 +93,7 @@ export default {
| `redisUrl` | string | `""` | Redis connection URL for delivery queue | | `redisUrl` | string | `""` | Redis connection URL for delivery queue |
| `parallelWorkers` | number | `5` | Number of parallel delivery workers (requires Redis) | | `parallelWorkers` | number | `5` | Number of parallel delivery workers (requires Redis) |
| `actorType` | string | `"Person"` | Actor type: `Person`, `Service`, `Organization`, or `Group` | | `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) | | `timelineRetention` | number | `1000` | Maximum timeline items to keep (0 = unlimited) |
### Redis (Recommended for Production) ### Redis (Recommended for Production)
+2
View File
@@ -82,6 +82,7 @@ const defaults = {
redisUrl: "", redisUrl: "",
parallelWorkers: 5, parallelWorkers: 5,
actorType: "Person", actorType: "Person",
logLevel: "warning",
timelineRetention: 1000, timelineRetention: 1000,
notificationRetentionDays: 30, notificationRetentionDays: 30,
}; };
@@ -891,6 +892,7 @@ export default class ActivityPubEndpoint {
publicationUrl: this._publicationUrl, publicationUrl: this._publicationUrl,
parallelWorkers: this.options.parallelWorkers, parallelWorkers: this.options.parallelWorkers,
actorType: this.options.actorType, actorType: this.options.actorType,
logLevel: this.options.logLevel,
}); });
this._federation = federation; this._federation = federation;
+5 -1
View File
@@ -60,6 +60,7 @@ export function setupFederation(options) {
publicationUrl = "", publicationUrl = "",
parallelWorkers = 5, parallelWorkers = 5,
actorType = "Person", actorType = "Person",
logLevel = "warning",
} = options; } = options;
// Map config string to Fedify actor class // Map config string to Fedify actor class
@@ -67,6 +68,9 @@ export function setupFederation(options) {
const ActorClass = actorTypeMap[actorType] || Person; const ActorClass = actorTypeMap[actorType] || Person;
// Configure LogTape for Fedify delivery logging (once per process) // 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) { if (!_logtapeConfigured) {
_logtapeConfigured = true; _logtapeConfigured = true;
configure({ configure({
@@ -79,7 +83,7 @@ export function setupFederation(options) {
// All Fedify logs — federation, vocab, delivery, HTTP signatures // All Fedify logs — federation, vocab, delivery, HTTP signatures
category: ["fedify"], category: ["fedify"],
sinks: ["console"], sinks: ["console"],
lowestLevel: "info", lowestLevel: resolvedLevel,
}, },
], ],
}).catch((error) => { }).catch((error) => {