From 031dad755f03a198ab9c4dc900ed3ae5700ac775 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 13 Aug 2021 14:56:49 -0400 Subject: [PATCH] Logging handler improvement --- MVMCore/MVMCore.xcodeproj/project.pbxproj | 4 ++++ .../LoadHandling/MVMCoreLoadRequestOperation.m | 2 +- .../MVMCoreLoggingHandler+Extension.swift | 15 +++++++++++++++ .../MVMCore/OtherHandlers/MVMCoreLoggingHandler.h | 3 +++ .../MVMCore/OtherHandlers/MVMCoreLoggingHandler.m | 3 ++- 5 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler+Extension.swift diff --git a/MVMCore/MVMCore.xcodeproj/project.pbxproj b/MVMCore/MVMCore.xcodeproj/project.pbxproj index bc5378c..22c445b 100644 --- a/MVMCore/MVMCore.xcodeproj/project.pbxproj +++ b/MVMCore/MVMCore.xcodeproj/project.pbxproj @@ -151,6 +151,7 @@ D27073D125BB844B001C7246 /* MVMCoreActionDelegateProtocol+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D27073D025BB844B001C7246 /* MVMCoreActionDelegateProtocol+Extension.swift */; }; D282AAB62240085300C46919 /* MVMCoreGetterUtility+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AAB52240085300C46919 /* MVMCoreGetterUtility+Extension.swift */; }; D282AAB82240342D00C46919 /* NSNumber+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AAB72240342D00C46919 /* NSNumber+Extension.swift */; }; + D288D5F526C6EFE000A5C365 /* MVMCoreLoggingHandler+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D288D5F426C6EFE000A5C365 /* MVMCoreLoggingHandler+Extension.swift */; }; D2DEDCB723C63F3B00C44CC4 /* Clamping.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DEDCB623C63F3B00C44CC4 /* Clamping.swift */; }; D2DEDCB923C6400600C44CC4 /* UnitInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DEDCB823C6400600C44CC4 /* UnitInterval.swift */; }; D2DEDCBB23C65BC300C44CC4 /* Percent.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DEDCBA23C65BC300C44CC4 /* Percent.swift */; }; @@ -297,6 +298,7 @@ D27073D025BB844B001C7246 /* MVMCoreActionDelegateProtocol+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreActionDelegateProtocol+Extension.swift"; sourceTree = ""; }; D282AAB52240085300C46919 /* MVMCoreGetterUtility+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreGetterUtility+Extension.swift"; sourceTree = ""; }; D282AAB72240342D00C46919 /* NSNumber+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSNumber+Extension.swift"; sourceTree = ""; }; + D288D5F426C6EFE000A5C365 /* MVMCoreLoggingHandler+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreLoggingHandler+Extension.swift"; sourceTree = ""; }; D2DEDCB623C63F3B00C44CC4 /* Clamping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Clamping.swift; sourceTree = ""; }; D2DEDCB823C6400600C44CC4 /* UnitInterval.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnitInterval.swift; sourceTree = ""; }; D2DEDCBA23C65BC300C44CC4 /* Percent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Percent.swift; sourceTree = ""; }; @@ -637,6 +639,7 @@ AF43A7081FC4F415008E9347 /* MVMCoreCache.m */, AFEEE81C1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.h */, AFEEE81D1FCDF3CA00B5EDD0 /* MVMCoreLoggingHandler.m */, + D288D5F426C6EFE000A5C365 /* MVMCoreLoggingHandler+Extension.swift */, ); path = OtherHandlers; sourceTree = ""; @@ -863,6 +866,7 @@ 0A42538F23F3414800554656 /* Codable+Helpers.swift in Sources */, 881D26931FCC9D180079C521 /* MVMCoreErrorObject.m in Sources */, 94C014D124211869005811A9 /* ActionRestartModel.swift in Sources */, + D288D5F526C6EFE000A5C365 /* MVMCoreLoggingHandler+Extension.swift in Sources */, 946EE1B0237B5EF70036751F /* JSONHelper.swift in Sources */, 30349BF21FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m in Sources */, D2DEDCB923C6400600C44CC4 /* UnitInterval.swift in Sources */, diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index de1488b..2b49d66 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -821,7 +821,7 @@ } + (void)loadPostAction:(nonnull MVMCoreLoadObject *)loadObject delegateObject:(nullable DelegateObject *)delegateObject { - NSDictionary *actionDict = [loadObject.responseJSON dict:@"PostAction"]; + NSDictionary *actionDict = [loadObject.responseJSON dict:KeyPostAction]; if (actionDict) { [[MVMCoreActionHandler sharedActionHandler] handleActionWithDictionary:actionDict additionalData:nil delegateObject:delegateObject]; } diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler+Extension.swift b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler+Extension.swift new file mode 100644 index 0000000..d74201e --- /dev/null +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler+Extension.swift @@ -0,0 +1,15 @@ +// +// MVMCoreLoggingHandler+Extension.swift +// MVMCore +// +// Created by Scott Pfeil on 8/13/21. +// Copyright © 2021 myverizon. All rights reserved. +// + +import Foundation + +@objc public extension MVMCoreLoggingHandler { + @objc func print(with message: String) { + Swift.print(message) + } +} diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h index 4cb1301..c3228c7 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.h @@ -26,4 +26,7 @@ + (void)logWithDelegateLoadFinished:(nullable MVMCoreLoadObject *)loadObject loadedViewController:(nullable UIViewController *)loadedViewController error:(nullable MVMCoreErrorObject *)error; + (void)logAlertForAlertController:(nullable MVMCoreAlertController *)alertController; +#pragma mark MVMCoreLoggingDelegateProtocol +- (void)handleDebugMessage:(nullable NSString *)message; + @end diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m index 376fb5b..766ee3d 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreLoggingHandler.m @@ -9,6 +9,7 @@ #import "MVMCoreLoggingHandler.h" #import "MVMCoreObject.h" #import "MVMCoreActionUtility.h" +#import @implementation MVMCoreLoggingHandler @@ -54,7 +55,7 @@ - (void)handleDebugMessage:(nullable NSString *)message { #ifdef DEBUG - NSLog(@"%@", message); + [self printWith:message]; #endif }