From d825d0e6bc7db24fd88d3821641083220e181d49 Mon Sep 17 00:00:00 2001 From: olivier Date: Sat, 28 Jan 2023 14:29:00 +0100 Subject: [PATCH] chore: review logs & add RNV prefix for easier filtering --- ios/Video/Features/RCTResourceLoaderDelegate.swift | 2 +- ios/Video/RCTVideo.swift | 2 +- ios/Video/RCTVideoSwiftLog/RCTVideoSwiftLog.swift | 14 ++++++++------ ios/VideoCaching/RCTVideoCache.m | 6 +++--- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ios/Video/Features/RCTResourceLoaderDelegate.swift b/ios/Video/Features/RCTResourceLoaderDelegate.swift index e1f11528..52228517 100644 --- a/ios/Video/Features/RCTResourceLoaderDelegate.swift +++ b/ios/Video/Features/RCTResourceLoaderDelegate.swift @@ -44,7 +44,7 @@ class RCTResourceLoaderDelegate: NSObject, AVAssetResourceLoaderDelegate, URLSes } func resourceLoader(_ resourceLoader:AVAssetResourceLoader, didCancel loadingRequest:AVAssetResourceLoadingRequest) { - NSLog("didCancelLoadingRequest") + RCTLog("didCancelLoadingRequest") } func setLicenseResult(_ license:String!) { diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index baca4d1a..17a899b7 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -1080,7 +1080,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH let newRect = change.newValue if !oldRect!.equalTo(newRect!) { if newRect!.equalTo(UIScreen.main.bounds) { - NSLog("in fullscreen") + RCTLog("in fullscreen") self.reactViewController().view.frame = UIScreen.main.bounds self.reactViewController().view.setNeedsLayout() diff --git a/ios/Video/RCTVideoSwiftLog/RCTVideoSwiftLog.swift b/ios/Video/RCTVideoSwiftLog/RCTVideoSwiftLog.swift index 99ca8e8a..0e0e1697 100644 --- a/ios/Video/RCTVideoSwiftLog/RCTVideoSwiftLog.swift +++ b/ios/Video/RCTVideoSwiftLog/RCTVideoSwiftLog.swift @@ -25,29 +25,31 @@ * way into one or the other eventually. Feel free to reuse it as desired. */ +let logHeader: String = "RNV:" + func RCTLogError(_ message: String, _ file: String=#file, _ line: UInt=#line) { - RCTVideoSwiftLog.error(message, file: file, line: line) + RCTVideoSwiftLog.error(logHeader + message, file: file, line: line) } func RCTLogWarn(_ message: String, _ file: String=#file, _ line: UInt=#line) { - RCTVideoSwiftLog.warn(message, file: file, line: line) + RCTVideoSwiftLog.warn(logHeader + message, file: file, line: line) } func RCTLogInfo(_ message: String, _ file: String=#file, _ line: UInt=#line) { - RCTVideoSwiftLog.info(message, file: file, line: line) + RCTVideoSwiftLog.info(logHeader + message, file: file, line: line) } func RCTLog(_ message: String, _ file: String=#file, _ line: UInt=#line) { - RCTVideoSwiftLog.log(message, file: file, line: line) + RCTVideoSwiftLog.log(logHeader + message, file: file, line: line) } func RCTLogTrace(_ message: String, _ file: String=#file, _ line: UInt=#line) { - RCTVideoSwiftLog.trace(message, file: file, line: line) + RCTVideoSwiftLog.trace(logHeader + message, file: file, line: line) } func DebugLog(_ message: String) { #if DEBUG - print(message) + print(logHeader + message) #endif } diff --git a/ios/VideoCaching/RCTVideoCache.m b/ios/VideoCaching/RCTVideoCache.m index 1a2b83a5..05ad65d4 100644 --- a/ios/VideoCaching/RCTVideoCache.m +++ b/ios/VideoCaching/RCTVideoCache.m @@ -30,7 +30,7 @@ options.useDirectorySeparation = NO; #ifdef DEBUG options.debugOutput = ^(NSString *string) { - NSLog(@"Video Cache: %@", string); + RCTLog(@"Video Cache: %@", string); }; #endif [self createTemporaryPath]; @@ -48,7 +48,7 @@ error:&error]; #ifdef DEBUG if (!success || error) { - NSLog(@"Error while! %@", error); + RCTLog(@"Error while! %@", error); } #endif } @@ -64,7 +64,7 @@ [self.videoCache storeData:data forKey:key locked:NO withCallback:^(SPTPersistentCacheResponse * _Nonnull response) { if (response.error) { #ifdef DEBUG - NSLog(@"An error occured while saving the video into the cache: %@", [response.error localizedDescription]); + RCTLog(@"An error occured while saving the video into the cache: %@", [response.error localizedDescription]); #endif handler(NO); return;