react-native-vision-camera/ios/React/ReactLogger.swift
Marc Rousavy 35806ff660
Upgrade Example to RN 0.64 (#83)
* ReactLogger: Also log function

* Run SwiftFormat & SwiftLint in example project

* Upgrade to RN 0.64 1/2

* Update lockfiles

* Upgrade a few packages

* index.tsx -> index.js

* Upgrade docusaurus

* Fix line length violation

* Update CameraView.swift

* Update gradle plugin

* Fix example to prefer higher res cameras

* Remove unused log line

* Update App.tsx
2021-03-19 15:53:19 +01:00

36 lines
1.1 KiB
Swift

//
// ReactLogger.swift
// Cuvent
//
// Created by Marc Rousavy on 15.12.20.
// Copyright © 2020 Facebook. All rights reserved.
//
import Foundation
let context = "VisionCamera"
// MARK: - ReactLogger
enum ReactLogger {
static func log(level: RCTLogLevel,
message: String,
alsoLogToJS: Bool = false,
_ file: String = #file,
_ lineNumber: Int = #line,
_ function: String = #function) {
RCTDefaultLogFunction(level, RCTLogSource.native, file, lineNumber as NSNumber, "\(context).\(function): \(message)")
if alsoLogToJS {
ReactLogger.logJS(level: level, message: message, file, lineNumber, function)
}
}
static func logJS(level: RCTLogLevel,
message: String,
_ file: String = #file,
_ lineNumber: Int = #line,
_ function: String = #function) {
RCTDefaultLogFunction(level, RCTLogSource.javaScript, file, lineNumber as NSNumber, "\(context).\(function): \(message)")
}
}