2021-02-19 16:28:05 +01:00
|
|
|
//
|
|
|
|
// ReactLogger.swift
|
2021-06-21 22:42:46 +02:00
|
|
|
// mrousavy
|
2021-02-19 16:28:05 +01:00
|
|
|
//
|
|
|
|
// Created by Marc Rousavy on 15.12.20.
|
2021-06-01 13:07:57 +02:00
|
|
|
// Copyright © 2020 mrousavy. All rights reserved.
|
2021-02-19 16:28:05 +01:00
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
2021-03-09 10:53:29 +01:00
|
|
|
// MARK: - ReactLogger
|
|
|
|
|
2021-02-19 16:28:05 +01:00
|
|
|
enum ReactLogger {
|
2021-06-03 14:16:02 +02:00
|
|
|
/**
|
|
|
|
Log a message to the console in the format of `VisionCamera.[caller-function-name]: [message]`
|
|
|
|
|
|
|
|
@discussion
|
|
|
|
If the global ConsoleLogFunction is set, this function also logs to the JavaScript console (console.log, console.trace, console.warn or console.error)
|
|
|
|
This function also always logs to [RCTDefaultLogFunction].
|
|
|
|
In non-DEBUG builds, this function is no-op.
|
|
|
|
*/
|
|
|
|
@inlinable
|
2021-03-19 15:53:19 +01:00
|
|
|
static func log(level: RCTLogLevel,
|
|
|
|
message: String,
|
|
|
|
_ file: String = #file,
|
|
|
|
_ lineNumber: Int = #line,
|
|
|
|
_ function: String = #function) {
|
2021-06-03 14:16:02 +02:00
|
|
|
#if DEBUG
|
|
|
|
RCTDefaultLogFunction(level, RCTLogSource.native, file, lineNumber as NSNumber, "VisionCamera.\(function): \(message)")
|
|
|
|
#endif
|
2021-02-19 16:28:05 +01:00
|
|
|
}
|
|
|
|
}
|