Loading CHANGES.md +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ To be released. logger categories are used: - `["fedify", "federation", "actor"]` - `["fedify", "federation", "http"]` Version 0.8.0 Loading docs/manual/log.md +16 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,13 @@ The `"fedify"` category is used for everything related to the Fedify library. The `["fedify", "federation"]` category is used for logging federation-related messages. ### `["fedify", "federation", "actor"]` *This category is available since Fedify 0.9.0.* The `["fedify", "federation", "actor"]` category is used for logging messages related to actor dispatcher. ### `["fedify", "federation", "collection"]` *This category is available since Fedify 0.8.0.* Loading @@ -125,6 +132,15 @@ messages. The `["fedify", "federation", "collection"]` category is used for logging messages related to collections (e.g., outbox, followers, following). ### `["fedify", "federation", "http"]` *This category is available since Fedify 0.9.0.* The `["fedify", "federation", "http"]` category is used for logging messages related to HTTP requests and responses. When you are curious about the HTTP requests and responses, you can check the log messages in this category with the `"info"` level. ### `["fedify", "federation", "inbox"]` The `["fedify", "federation", "inbox"]` category is used for logging messages Loading federation/middleware.ts +20 −0 Original line number Diff line number Diff line Loading @@ -1320,6 +1320,26 @@ export class Federation<TContextData> { * @since 0.6.0 */ async fetch( request: Request, options: FederationFetchOptions<TContextData>, ): Promise<Response> { const response = await this.#fetch(request, options); const logger = getLogger(["fedify", "federation", "http"]); const url = new URL(request.url); const logTpl = "{method} {path}: {status}"; const values = { method: request.method, path: `${url.pathname}${url.search}`, url: request.url, status: response.status, }; if (response.status >= 500) logger.error(logTpl, values); else if (response.status >= 400) logger.warn(logTpl, values); else logger.info(logTpl, values); return response; } async #fetch( request: Request, { onNotFound, Loading Loading
CHANGES.md +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ To be released. logger categories are used: - `["fedify", "federation", "actor"]` - `["fedify", "federation", "http"]` Version 0.8.0 Loading
docs/manual/log.md +16 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,13 @@ The `"fedify"` category is used for everything related to the Fedify library. The `["fedify", "federation"]` category is used for logging federation-related messages. ### `["fedify", "federation", "actor"]` *This category is available since Fedify 0.9.0.* The `["fedify", "federation", "actor"]` category is used for logging messages related to actor dispatcher. ### `["fedify", "federation", "collection"]` *This category is available since Fedify 0.8.0.* Loading @@ -125,6 +132,15 @@ messages. The `["fedify", "federation", "collection"]` category is used for logging messages related to collections (e.g., outbox, followers, following). ### `["fedify", "federation", "http"]` *This category is available since Fedify 0.9.0.* The `["fedify", "federation", "http"]` category is used for logging messages related to HTTP requests and responses. When you are curious about the HTTP requests and responses, you can check the log messages in this category with the `"info"` level. ### `["fedify", "federation", "inbox"]` The `["fedify", "federation", "inbox"]` category is used for logging messages Loading
federation/middleware.ts +20 −0 Original line number Diff line number Diff line Loading @@ -1320,6 +1320,26 @@ export class Federation<TContextData> { * @since 0.6.0 */ async fetch( request: Request, options: FederationFetchOptions<TContextData>, ): Promise<Response> { const response = await this.#fetch(request, options); const logger = getLogger(["fedify", "federation", "http"]); const url = new URL(request.url); const logTpl = "{method} {path}: {status}"; const values = { method: request.method, path: `${url.pathname}${url.search}`, url: request.url, status: response.status, }; if (response.status >= 500) logger.error(logTpl, values); else if (response.status >= 400) logger.warn(logTpl, values); else logger.info(logTpl, values); return response; } async #fetch( request: Request, { onNotFound, Loading