[PR #665] Added custom log action #712

Open
opened 2026-03-03 17:29:47 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/OAuthSwift/OAuthSwift/pull/665
Author: @Vortec4800
Created: 6/11/2021
Status: 🔄 Open

Base: masterHead: custom-logger


📝 Commits (1)

📊 Changes

2 files changed (+31 additions, -3 deletions)

View changed files

📝 Sources/OAuthLogProtocol.swift (+21 -3)
📝 Sources/OAuthSwift.swift (+10 -0)

📄 Description

The new logging mechanism looks really useful, however, I wanted to extend it to integrate with my app's existing logging system. I added a custom log action that accepts a closure, and the log action is used instead of just printing to the console so the actual log can be customized.

This extends the work done by @svoip and the logging system.

In order to use this new functionality, you would add something like this:

OAuthSwift.setLogLevel(.trace)
OAuthSwift.setCustomLogAction { message in
   CustomLogger("[OAUTHSWIFT] \(message)")
}

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/OAuthSwift/OAuthSwift/pull/665 **Author:** [@Vortec4800](https://github.com/Vortec4800) **Created:** 6/11/2021 **Status:** 🔄 Open **Base:** `master` ← **Head:** `custom-logger` --- ### 📝 Commits (1) - [`76c79f9`](https://github.com/OAuthSwift/OAuthSwift/commit/76c79f9ae2f089bb370986bd574ba0910ff1c302) Added custom log action ### 📊 Changes **2 files changed** (+31 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `Sources/OAuthLogProtocol.swift` (+21 -3) 📝 `Sources/OAuthSwift.swift` (+10 -0) </details> ### 📄 Description The new logging mechanism looks really useful, however, I wanted to extend it to integrate with my app's existing logging system. I added a custom log action that accepts a closure, and the log action is used instead of just printing to the console so the actual log can be customized. This extends the work done by @svoip and the logging system. In order to use this new functionality, you would add something like this: ```swift OAuthSwift.setLogLevel(.trace) OAuthSwift.setCustomLogAction { message in CustomLogger("[OAUTHSWIFT] \(message)") } ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#712
No description provided.