2022-05-19 07:29:25 -06:00
|
|
|
//
|
2023-12-07 00:47:40 -07:00
|
|
|
// RCTVideoSwiftLog.swift
|
2022-05-19 07:29:25 -06:00
|
|
|
// WebViewExample
|
|
|
|
//
|
|
|
|
// Created by Jimmy Dee on 4/5/17.
|
|
|
|
// Copyright © 2017 Branch Metrics. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Under at least some conditions, output from NSLog has been unavailable in the RNBranch module.
|
|
|
|
* Hence that module uses the RCTLog macros from <React/RCTLog.h>. The React logger is nicer than
|
|
|
|
* NSLog anyway, since it provides log levels with runtime filtering, file and line context and
|
|
|
|
* an identifier for the thread that logged the message.
|
|
|
|
*
|
|
|
|
* This wrapper lets you use functions with the same name in Swift. For example:
|
|
|
|
*
|
|
|
|
* RCTLogInfo("application launched")
|
|
|
|
*
|
|
|
|
* generates
|
|
|
|
*
|
|
|
|
* 2017-04-06 12:31:09.611 [info][tid:main][AppDelegate.swift:18] application launched
|
|
|
|
*
|
|
|
|
* This is currently part of this sample app. There may be some issues integrating it into an
|
|
|
|
* Objective-C library, either react-native-branch or react-native itself, but it may find its
|
|
|
|
* way into one or the other eventually. Feel free to reuse it as desired.
|
|
|
|
*/
|
|
|
|
|
2023-01-28 06:29:00 -07:00
|
|
|
let logHeader: String = "RNV:"
|
|
|
|
|
2023-12-07 00:47:40 -07:00
|
|
|
func RCTLogError(_ message: String, _ file: String = #file, _ line: UInt = #line) {
|
2023-01-28 06:29:00 -07:00
|
|
|
RCTVideoSwiftLog.error(logHeader + message, file: file, line: line)
|
2022-05-19 07:29:25 -06:00
|
|
|
}
|
|
|
|
|
2023-12-07 00:47:40 -07:00
|
|
|
func RCTLogWarn(_ message: String, _ file: String = #file, _ line: UInt = #line) {
|
2023-01-28 06:29:00 -07:00
|
|
|
RCTVideoSwiftLog.warn(logHeader + message, file: file, line: line)
|
2022-05-19 07:29:25 -06:00
|
|
|
}
|
|
|
|
|
2023-12-07 00:47:40 -07:00
|
|
|
func RCTLogInfo(_ message: String, _ file: String = #file, _ line: UInt = #line) {
|
2023-01-28 06:29:00 -07:00
|
|
|
RCTVideoSwiftLog.info(logHeader + message, file: file, line: line)
|
2022-05-19 07:29:25 -06:00
|
|
|
}
|
|
|
|
|
2023-12-07 00:47:40 -07:00
|
|
|
func RCTLog(_ message: String, _ file: String = #file, _ line: UInt = #line) {
|
2023-01-28 06:29:00 -07:00
|
|
|
RCTVideoSwiftLog.log(logHeader + message, file: file, line: line)
|
2022-05-19 07:29:25 -06:00
|
|
|
}
|
|
|
|
|
2023-12-07 00:47:40 -07:00
|
|
|
func RCTLogTrace(_ message: String, _ file: String = #file, _ line: UInt = #line) {
|
2023-01-28 06:29:00 -07:00
|
|
|
RCTVideoSwiftLog.trace(logHeader + message, file: file, line: line)
|
2022-05-19 07:29:25 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func DebugLog(_ message: String) {
|
2023-12-07 00:47:40 -07:00
|
|
|
#if DEBUG
|
|
|
|
print(logHeader + message)
|
|
|
|
#endif
|
2022-05-19 07:29:25 -06:00
|
|
|
}
|