diff --git a/MVMCore/MVMCore/ActionHandling/ActionOpenPageModel.swift b/MVMCore/MVMCore/ActionHandling/ActionOpenPageModel.swift index c8362a8..ac7ee02 100644 --- a/MVMCore/MVMCore/ActionHandling/ActionOpenPageModel.swift +++ b/MVMCore/MVMCore/ActionHandling/ActionOpenPageModel.swift @@ -116,3 +116,13 @@ public struct ActionOpenPageModel: ActionModelProtocol, ActionOpenPageProtocol, try container.encodeIfPresent(fallbackResponse, forKey: .fallbackResponse) } } + +extension ActionOpenPageModel: CustomDebugStringConvertible { + public var debugDescription: String { + if let requestURL { + return "\(Self.self) for \(pageType) @ \(requestURL)" + } else { + return "\(Self.self) for \(pageType)" + } + } +} diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler+Extension.swift b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler+Extension.swift index d74201e..cc80a81 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler+Extension.swift +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler+Extension.swift @@ -13,3 +13,28 @@ import Foundation Swift.print(message) } } + +public protocol CoreLogging { + func debugLog(_ string: String) + + var loggingPrefix: String { get } +} + +public extension CoreLogging { + + var loggingPrefix: String { + return String(describing: self) + } + + static func debugLog(_ string: String) { + #if LOGGING + MVMCoreLoggingHandler.shared()?.handleDebugMessage("\(String(describing: Self.self)) \(string)") + #endif + } + + func debugLog(_ string: String) { + #if LOGGING + MVMCoreLoggingHandler.shared()?.handleDebugMessage("\(loggingPrefix) " + string) + #endif + } +}