Files
OrderScheduling/Pods/CocoaDebug/Sources/Core/CocoaDebug.swift
DDIsFriend 63ca919ed5 update
2023-08-23 09:24:40 +08:00

66 lines
3.1 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// Example
// man
//
// Created by man 11/11/2018.
// Copyright © 2020 man. All rights reserved.
//
import Foundation
import UIKit
@objc public class CocoaDebug : NSObject {
///if the captured URLs contain server URL, CocoaDebug set server URL bold font to be marked. Not mark when this value is nil. Default value is `nil`.
@objc public static var serverURL: String? = nil
///set the URLs which should not been captured, CocoaDebug capture all URLs when the value is nil. Default value is `nil`.
@objc public static var ignoredURLs: [String]? = nil
///set the URLs which are only been captured, CocoaDebug capture all URLs when the value is nil. Default value is `nil`.
@objc public static var onlyURLs: [String]? = nil
///set the prefix Logs which should not been captured, CocoaDebug capture all Logs when the value is nil. Default value is `nil`.
@objc public static var ignoredPrefixLogs: [String]? = nil
///set the prefix Logs which are only been captured, CocoaDebug capture all Logs when the value is nil. Default value is `nil`.
@objc public static var onlyPrefixLogs: [String]? = nil
///add an additional UIViewController as child controller of CocoaDebug's main UITabBarController. Default value is `nil`.
@objc public static var additionalViewController: UIViewController? = nil
///set the initial recipients to include in the emails To field when share via email. Default value is `nil`.
@objc public static var emailToRecipients: [String]? = nil
///set the initial recipients to include in the emails Cc field when share via email. Default value is `nil`.
@objc public static var emailCcRecipients: [String]? = nil
///set CocoaDebug's main color with hexadecimal format. Default value is `#42d459`.
@objc public static var mainColor: String = "#42d459"
///protobuf url and response class transfer map. Default value is `nil`.
@objc public static var protobufTransferMap: [String: [String]]? = nil
//MARK: - CocoaDebug enable
@objc public static func enable() {
initializationMethod(serverURL: serverURL, ignoredURLs: ignoredURLs, onlyURLs: onlyURLs, ignoredPrefixLogs: ignoredPrefixLogs, onlyPrefixLogs: onlyPrefixLogs, additionalViewController: additionalViewController, emailToRecipients: emailToRecipients, emailCcRecipients: emailCcRecipients, mainColor: mainColor, protobufTransferMap: protobufTransferMap)
}
//MARK: - CocoaDebug disable
@objc public static func disable() {
deinitializationMethod()
}
//MARK: - hide Bubble
@objc public static func hideBubble() {
CocoaDebugSettings.shared.showBubbleAndWindow = false
}
//MARK: - show Bubble
@objc public static func showBubble() {
CocoaDebugSettings.shared.showBubbleAndWindow = true
}
}
//MARK: - override Swift `print` method
public func print<T>(file: String = #file, function: String = #function, line: Int = #line, _ message: T, color: UIColor = .white) {
Swift.print(message)
_SwiftLogHelper.shared.handleLog(file: file, function: function, line: line, message: message, color: color)
}