Merge pull request #3018 from iFeelSmart/chore/review_ios_logs

chore: review logs & add RNV prefix for easier filtering
This commit is contained in:
Olivier Bouillet 2023-02-09 22:00:25 +01:00 committed by GitHub
commit 947fa90634
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 11 deletions

View File

@ -44,7 +44,7 @@ class RCTResourceLoaderDelegate: NSObject, AVAssetResourceLoaderDelegate, URLSes
} }
func resourceLoader(_ resourceLoader:AVAssetResourceLoader, didCancel loadingRequest:AVAssetResourceLoadingRequest) { func resourceLoader(_ resourceLoader:AVAssetResourceLoader, didCancel loadingRequest:AVAssetResourceLoadingRequest) {
NSLog("didCancelLoadingRequest") RCTLog("didCancelLoadingRequest")
} }
func setLicenseResult(_ license:String!) { func setLicenseResult(_ license:String!) {

View File

@ -1076,7 +1076,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
let newRect = change.newValue let newRect = change.newValue
if !oldRect!.equalTo(newRect!) { if !oldRect!.equalTo(newRect!) {
if newRect!.equalTo(UIScreen.main.bounds) { if newRect!.equalTo(UIScreen.main.bounds) {
NSLog("in fullscreen") RCTLog("in fullscreen")
self.reactViewController().view.frame = UIScreen.main.bounds self.reactViewController().view.frame = UIScreen.main.bounds
self.reactViewController().view.setNeedsLayout() self.reactViewController().view.setNeedsLayout()

View File

@ -25,29 +25,31 @@
* way into one or the other eventually. Feel free to reuse it as desired. * 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) { 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) { 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) { 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) { 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) { 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) { func DebugLog(_ message: String) {
#if DEBUG #if DEBUG
print(message) print(logHeader + message)
#endif #endif
} }

View File

@ -30,7 +30,7 @@
options.useDirectorySeparation = NO; options.useDirectorySeparation = NO;
#ifdef DEBUG #ifdef DEBUG
options.debugOutput = ^(NSString *string) { options.debugOutput = ^(NSString *string) {
NSLog(@"Video Cache: %@", string); RCTLog(@"Video Cache: %@", string);
}; };
#endif #endif
[self createTemporaryPath]; [self createTemporaryPath];
@ -48,7 +48,7 @@
error:&error]; error:&error];
#ifdef DEBUG #ifdef DEBUG
if (!success || error) { if (!success || error) {
NSLog(@"Error while! %@", error); RCTLog(@"Error while! %@", error);
} }
#endif #endif
} }
@ -64,7 +64,7 @@
[self.videoCache storeData:data forKey:key locked:NO withCallback:^(SPTPersistentCacheResponse * _Nonnull response) { [self.videoCache storeData:data forKey:key locked:NO withCallback:^(SPTPersistentCacheResponse * _Nonnull response) {
if (response.error) { if (response.error) {
#ifdef DEBUG #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 #endif
handler(NO); handler(NO);
return; return;