[Feature Enhancement]: Complete Logging Implementation
関連するプルリクエストがすでにマージされています。
- #9 @MasterJ93 による — マージ済み
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- swift
調査の方向性
Read the package areas for ATProtoKit, ATProtoTools, and ATProtoAdmin, then inspect the applyWrites() example in the issue as a guide to the requested logging points. Add logging across all three classes, including session and request failures and outcomes; completion means all three checklist items are covered. A linked pull request was merged, so check its changes and the current code before taking this on.
索引モデルが issue の本文から書いたものです。
説明
Summary
No response
Pain points
The current implementation of ATProtoKit lacks a centralized logging mechanism, leading to several challenges, namely that debugging is much more difficult to deal with.
To solve this, SwiftLog will be integrated into the package. Furthermore, two logging backend implementations will be used: one that maps to Apple's unified Logger framework (for Apple platforms) and one that maps to the standard SwiftLog logger.
To be more specific, log events for the methods should be added as appropriate. As an example, take a look at applyWrites():
public func applyWrites(_ repositoryDID: String,
shouldValidate: Bool? = true,
writes: [ApplyWritesUnion],
swapCommit: String?) async throws {
guard session != nil,
let accessToken = session?.accessToken else {
throw ATRequestPrepareError.missingActiveSession
}
guard let sessionURL = session?.pdsURL,
let requestURL = URL(string: "\(sessionURL)/xrpc/com.atproto.repo.applyWrites") else {
throw ATRequestPrepareError.invalidRequestURL
}
let requestBody = RepoApplyWrites(
repositoryDID: repositoryDID,
shouldValidate: shouldValidate,
writes: writes,
swapCommit: swapCommit
)
do {
let request = APIClientService.createRequest(forRequest: requestURL,
andMethod: .post,
acceptValue: nil,
contentTypeValue: "application/json",
authorizationValue: "Bearer \(accessToken)")
try await APIClientService.sendRequest(request,
withEncodingBody: requestBody)
} catch {
throw error
}
}
Various places within the method can have log events, including:
- Within the first
guardstatement'selseblock, stating thatsessionoraccessTokendoesn't have a value. - After the
guardstatement which would show the value ofaccessToken(albeit, obfuscated). - Within the second
guardstatement'selseblock, stating that there's an invalid request URL, followed by aString(describing:)of the request URL. - After the
guardstatement, which would show the value ofrequestURL. - After
requestBody, which would show the values ofrequestBody. - After
request, which would show the value ofrequest. - After the
try awaitcode, which would say that the request has been successful. - Within the
catchblock, which gives an error log, followed by displaying the error itself.
This issue will focus on implementing log events to the ATProtoKit, ATProtoTools, and ATProtoAdmin classes. Future updates will deal with the remaining parts of the Swift package.
Considered Alternatives
No response
Is this a breaking change?
Yes
Additional Context
- Implement log events on all parts of the
ATProtoKitclass. - Implement log events on all parts of the
ATProtoAdminclass. - Implement log events on all parts of the
ATProtoToolsclass.
- 主要言語
- Swift
- スター
- 226
- フォーク
- 40
- 平均マージ
- 5時間 8分
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MasterJ93/ATProtoKit のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
MasterJ93/ATProtoKit#344 ·
-
enhancement
難易度 4/5 1〜2日 初心者へのやさしさ 52/100
MasterJ93/ATProtoKit#337 · コメント 3 件 ·
-
new feature
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
MasterJ93/ATProtoKit#321 · コメント 1 件 ·
-
new feature
難易度 4/5 3〜5日 初心者へのやさしさ 43/100
MasterJ93/ATProtoKit#320 · コメント 1 件 ·
-
new feature
難易度 4/5 1〜2日 初心者へのやさしさ 55/100
MasterJ93/ATProtoKit#316 · コメント 1 件 ·
MasterJ93/ATProtoKit の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
🎉 Add Woundオープン
難易度 1/5 1時間未満 初心者へのやさしさ 77/100
jaywcjlove/awesome-mac#4357 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
VictorKildahl/cra#243 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
OneBusAway/vehicle-positions#260 ·
メンテナーはふだん 1 日以内に返信