@onekeyfe/react-native-native-logger 1.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/ReactNativeNativeLogger.podspec +29 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +132 -0
  6. package/android/gradle.properties +4 -0
  7. package/android/src/main/AndroidManifest.xml +1 -0
  8. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  9. package/android/src/main/java/com/margelo/nitro/nativelogger/NativeLogger.kt +51 -0
  10. package/android/src/main/java/com/margelo/nitro/nativelogger/NativeLoggerPackage.kt +24 -0
  11. package/android/src/main/java/com/margelo/nitro/nativelogger/OneKeyLog.kt +131 -0
  12. package/ios/NativeLogger.swift +54 -0
  13. package/ios/OneKeyLog.swift +148 -0
  14. package/lib/module/NativeLogger.nitro.js +4 -0
  15. package/lib/module/NativeLogger.nitro.js.map +1 -0
  16. package/lib/module/index.js +6 -0
  17. package/lib/module/index.js.map +1 -0
  18. package/lib/module/package.json +1 -0
  19. package/lib/typescript/package.json +1 -0
  20. package/lib/typescript/src/NativeLogger.nitro.d.ts +10 -0
  21. package/lib/typescript/src/NativeLogger.nitro.d.ts.map +1 -0
  22. package/lib/typescript/src/index.d.ts +4 -0
  23. package/lib/typescript/src/index.d.ts.map +1 -0
  24. package/nitro.json +17 -0
  25. package/nitrogen/generated/android/c++/JHybridNativeLoggerSpec.cpp +94 -0
  26. package/nitrogen/generated/android/c++/JHybridNativeLoggerSpec.hpp +67 -0
  27. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelogger/HybridNativeLoggerSpec.kt +66 -0
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelogger/nativeloggerOnLoad.kt +35 -0
  29. package/nitrogen/generated/android/nativelogger+autolinking.cmake +81 -0
  30. package/nitrogen/generated/android/nativelogger+autolinking.gradle +27 -0
  31. package/nitrogen/generated/android/nativeloggerOnLoad.cpp +44 -0
  32. package/nitrogen/generated/android/nativeloggerOnLoad.hpp +25 -0
  33. package/nitrogen/generated/ios/ReactNativeNativeLogger+autolinking.rb +60 -0
  34. package/nitrogen/generated/ios/ReactNativeNativeLogger-Swift-Cxx-Bridge.cpp +57 -0
  35. package/nitrogen/generated/ios/ReactNativeNativeLogger-Swift-Cxx-Bridge.hpp +175 -0
  36. package/nitrogen/generated/ios/ReactNativeNativeLogger-Swift-Cxx-Umbrella.hpp +46 -0
  37. package/nitrogen/generated/ios/ReactNativeNativeLoggerAutolinking.mm +33 -0
  38. package/nitrogen/generated/ios/ReactNativeNativeLoggerAutolinking.swift +25 -0
  39. package/nitrogen/generated/ios/c++/HybridNativeLoggerSpecSwift.cpp +11 -0
  40. package/nitrogen/generated/ios/c++/HybridNativeLoggerSpecSwift.hpp +92 -0
  41. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  42. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  43. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +47 -0
  44. package/nitrogen/generated/ios/swift/HybridNativeLoggerSpec.swift +58 -0
  45. package/nitrogen/generated/ios/swift/HybridNativeLoggerSpec_cxx.swift +174 -0
  46. package/nitrogen/generated/shared/c++/HybridNativeLoggerSpec.cpp +23 -0
  47. package/nitrogen/generated/shared/c++/HybridNativeLoggerSpec.hpp +66 -0
  48. package/package.json +169 -0
  49. package/src/NativeLogger.nitro.ts +8 -0
  50. package/src/index.tsx +8 -0
@@ -0,0 +1,175 @@
1
+ ///
2
+ /// ReactNativeNativeLogger-Swift-Cxx-Bridge.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `HybridNativeLoggerSpec` to properly resolve imports.
12
+ namespace margelo::nitro::nativelogger { class HybridNativeLoggerSpec; }
13
+
14
+ // Forward declarations of Swift defined types
15
+ // Forward declaration of `HybridNativeLoggerSpec_cxx` to properly resolve imports.
16
+ namespace ReactNativeNativeLogger { class HybridNativeLoggerSpec_cxx; }
17
+
18
+ // Include C++ defined types
19
+ #include "HybridNativeLoggerSpec.hpp"
20
+ #include <NitroModules/Promise.hpp>
21
+ #include <NitroModules/PromiseHolder.hpp>
22
+ #include <NitroModules/Result.hpp>
23
+ #include <exception>
24
+ #include <functional>
25
+ #include <memory>
26
+ #include <string>
27
+ #include <vector>
28
+
29
+ /**
30
+ * Contains specialized versions of C++ templated types so they can be accessed from Swift,
31
+ * as well as helper functions to interact with those C++ types from Swift.
32
+ */
33
+ namespace margelo::nitro::nativelogger::bridge::swift {
34
+
35
+ // pragma MARK: std::vector<std::string>
36
+ /**
37
+ * Specialized version of `std::vector<std::string>`.
38
+ */
39
+ using std__vector_std__string_ = std::vector<std::string>;
40
+ inline std::vector<std::string> create_std__vector_std__string_(size_t size) noexcept {
41
+ std::vector<std::string> vector;
42
+ vector.reserve(size);
43
+ return vector;
44
+ }
45
+
46
+ // pragma MARK: std::shared_ptr<Promise<std::vector<std::string>>>
47
+ /**
48
+ * Specialized version of `std::shared_ptr<Promise<std::vector<std::string>>>`.
49
+ */
50
+ using std__shared_ptr_Promise_std__vector_std__string___ = std::shared_ptr<Promise<std::vector<std::string>>>;
51
+ inline std::shared_ptr<Promise<std::vector<std::string>>> create_std__shared_ptr_Promise_std__vector_std__string___() noexcept {
52
+ return Promise<std::vector<std::string>>::create();
53
+ }
54
+ inline PromiseHolder<std::vector<std::string>> wrap_std__shared_ptr_Promise_std__vector_std__string___(std::shared_ptr<Promise<std::vector<std::string>>> promise) noexcept {
55
+ return PromiseHolder<std::vector<std::string>>(std::move(promise));
56
+ }
57
+
58
+ // pragma MARK: std::function<void(const std::vector<std::string>& /* result */)>
59
+ /**
60
+ * Specialized version of `std::function<void(const std::vector<std::string>&)>`.
61
+ */
62
+ using Func_void_std__vector_std__string_ = std::function<void(const std::vector<std::string>& /* result */)>;
63
+ /**
64
+ * Wrapper class for a `std::function<void(const std::vector<std::string>& / * result * /)>`, this can be used from Swift.
65
+ */
66
+ class Func_void_std__vector_std__string__Wrapper final {
67
+ public:
68
+ explicit Func_void_std__vector_std__string__Wrapper(std::function<void(const std::vector<std::string>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::vector<std::string>& /* result */)>>(std::move(func))) {}
69
+ inline void call(std::vector<std::string> result) const noexcept {
70
+ _function->operator()(result);
71
+ }
72
+ private:
73
+ std::unique_ptr<std::function<void(const std::vector<std::string>& /* result */)>> _function;
74
+ } SWIFT_NONCOPYABLE;
75
+ Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* NON_NULL swiftClosureWrapper) noexcept;
76
+ inline Func_void_std__vector_std__string__Wrapper wrap_Func_void_std__vector_std__string_(Func_void_std__vector_std__string_ value) noexcept {
77
+ return Func_void_std__vector_std__string__Wrapper(std::move(value));
78
+ }
79
+
80
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
81
+ /**
82
+ * Specialized version of `std::function<void(const std::exception_ptr&)>`.
83
+ */
84
+ using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
85
+ /**
86
+ * Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
87
+ */
88
+ class Func_void_std__exception_ptr_Wrapper final {
89
+ public:
90
+ explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
91
+ inline void call(std::exception_ptr error) const noexcept {
92
+ _function->operator()(error);
93
+ }
94
+ private:
95
+ std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
96
+ } SWIFT_NONCOPYABLE;
97
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
98
+ inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
99
+ return Func_void_std__exception_ptr_Wrapper(std::move(value));
100
+ }
101
+
102
+ // pragma MARK: std::shared_ptr<Promise<void>>
103
+ /**
104
+ * Specialized version of `std::shared_ptr<Promise<void>>`.
105
+ */
106
+ using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>;
107
+ inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() noexcept {
108
+ return Promise<void>::create();
109
+ }
110
+ inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) noexcept {
111
+ return PromiseHolder<void>(std::move(promise));
112
+ }
113
+
114
+ // pragma MARK: std::function<void()>
115
+ /**
116
+ * Specialized version of `std::function<void()>`.
117
+ */
118
+ using Func_void = std::function<void()>;
119
+ /**
120
+ * Wrapper class for a `std::function<void()>`, this can be used from Swift.
121
+ */
122
+ class Func_void_Wrapper final {
123
+ public:
124
+ explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
125
+ inline void call() const noexcept {
126
+ _function->operator()();
127
+ }
128
+ private:
129
+ std::unique_ptr<std::function<void()>> _function;
130
+ } SWIFT_NONCOPYABLE;
131
+ Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
132
+ inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
133
+ return Func_void_Wrapper(std::move(value));
134
+ }
135
+
136
+ // pragma MARK: std::shared_ptr<HybridNativeLoggerSpec>
137
+ /**
138
+ * Specialized version of `std::shared_ptr<HybridNativeLoggerSpec>`.
139
+ */
140
+ using std__shared_ptr_HybridNativeLoggerSpec_ = std::shared_ptr<HybridNativeLoggerSpec>;
141
+ std::shared_ptr<HybridNativeLoggerSpec> create_std__shared_ptr_HybridNativeLoggerSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
142
+ void* NON_NULL get_std__shared_ptr_HybridNativeLoggerSpec_(std__shared_ptr_HybridNativeLoggerSpec_ cppType);
143
+
144
+ // pragma MARK: std::weak_ptr<HybridNativeLoggerSpec>
145
+ using std__weak_ptr_HybridNativeLoggerSpec_ = std::weak_ptr<HybridNativeLoggerSpec>;
146
+ inline std__weak_ptr_HybridNativeLoggerSpec_ weakify_std__shared_ptr_HybridNativeLoggerSpec_(const std::shared_ptr<HybridNativeLoggerSpec>& strong) noexcept { return strong; }
147
+
148
+ // pragma MARK: Result<void>
149
+ using Result_void_ = Result<void>;
150
+ inline Result_void_ create_Result_void_() noexcept {
151
+ return Result<void>::withValue();
152
+ }
153
+ inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
154
+ return Result<void>::withError(error);
155
+ }
156
+
157
+ // pragma MARK: Result<std::shared_ptr<Promise<std::vector<std::string>>>>
158
+ using Result_std__shared_ptr_Promise_std__vector_std__string____ = Result<std::shared_ptr<Promise<std::vector<std::string>>>>;
159
+ inline Result_std__shared_ptr_Promise_std__vector_std__string____ create_Result_std__shared_ptr_Promise_std__vector_std__string____(const std::shared_ptr<Promise<std::vector<std::string>>>& value) noexcept {
160
+ return Result<std::shared_ptr<Promise<std::vector<std::string>>>>::withValue(value);
161
+ }
162
+ inline Result_std__shared_ptr_Promise_std__vector_std__string____ create_Result_std__shared_ptr_Promise_std__vector_std__string____(const std::exception_ptr& error) noexcept {
163
+ return Result<std::shared_ptr<Promise<std::vector<std::string>>>>::withError(error);
164
+ }
165
+
166
+ // pragma MARK: Result<std::shared_ptr<Promise<void>>>
167
+ using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>;
168
+ inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) noexcept {
169
+ return Result<std::shared_ptr<Promise<void>>>::withValue(value);
170
+ }
171
+ inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) noexcept {
172
+ return Result<std::shared_ptr<Promise<void>>>::withError(error);
173
+ }
174
+
175
+ } // namespace margelo::nitro::nativelogger::bridge::swift
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// ReactNativeNativeLogger-Swift-Cxx-Umbrella.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `HybridNativeLoggerSpec` to properly resolve imports.
12
+ namespace margelo::nitro::nativelogger { class HybridNativeLoggerSpec; }
13
+
14
+ // Include C++ defined types
15
+ #include "HybridNativeLoggerSpec.hpp"
16
+ #include <NitroModules/Promise.hpp>
17
+ #include <NitroModules/Result.hpp>
18
+ #include <exception>
19
+ #include <memory>
20
+ #include <string>
21
+ #include <vector>
22
+
23
+ // C++ helpers for Swift
24
+ #include "ReactNativeNativeLogger-Swift-Cxx-Bridge.hpp"
25
+
26
+ // Common C++ types used in Swift
27
+ #include <NitroModules/ArrayBufferHolder.hpp>
28
+ #include <NitroModules/AnyMapUtils.hpp>
29
+ #include <NitroModules/RuntimeError.hpp>
30
+ #include <NitroModules/DateToChronoDate.hpp>
31
+
32
+ // Forward declarations of Swift defined types
33
+ // Forward declaration of `HybridNativeLoggerSpec_cxx` to properly resolve imports.
34
+ namespace ReactNativeNativeLogger { class HybridNativeLoggerSpec_cxx; }
35
+
36
+ // Include Swift defined types
37
+ #if __has_include("ReactNativeNativeLogger-Swift.h")
38
+ // This header is generated by Xcode/Swift on every app build.
39
+ // If it cannot be found, make sure the Swift module's name (= podspec name) is actually "ReactNativeNativeLogger".
40
+ #include "ReactNativeNativeLogger-Swift.h"
41
+ // Same as above, but used when building with frameworks (`use_frameworks`)
42
+ #elif __has_include(<ReactNativeNativeLogger/ReactNativeNativeLogger-Swift.h>)
43
+ #include <ReactNativeNativeLogger/ReactNativeNativeLogger-Swift.h>
44
+ #else
45
+ #error ReactNativeNativeLogger's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "ReactNativeNativeLogger", and try building the app first.
46
+ #endif
@@ -0,0 +1,33 @@
1
+ ///
2
+ /// ReactNativeNativeLoggerAutolinking.mm
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <NitroModules/HybridObjectRegistry.hpp>
10
+ #import "ReactNativeNativeLogger-Swift-Cxx-Umbrella.hpp"
11
+ #import <type_traits>
12
+
13
+ #include "HybridNativeLoggerSpecSwift.hpp"
14
+
15
+ @interface ReactNativeNativeLoggerAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation ReactNativeNativeLoggerAutolinking
19
+
20
+ + (void) load {
21
+ using namespace margelo::nitro;
22
+ using namespace margelo::nitro::nativelogger;
23
+
24
+ HybridObjectRegistry::registerHybridObjectConstructor(
25
+ "NativeLogger",
26
+ []() -> std::shared_ptr<HybridObject> {
27
+ std::shared_ptr<HybridNativeLoggerSpec> hybridObject = ReactNativeNativeLogger::ReactNativeNativeLoggerAutolinking::createNativeLogger();
28
+ return hybridObject;
29
+ }
30
+ );
31
+ }
32
+
33
+ @end
@@ -0,0 +1,25 @@
1
+ ///
2
+ /// ReactNativeNativeLoggerAutolinking.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ public final class ReactNativeNativeLoggerAutolinking {
9
+ public typealias bridge = margelo.nitro.nativelogger.bridge.swift
10
+
11
+ /**
12
+ * Creates an instance of a Swift class that implements `HybridNativeLoggerSpec`,
13
+ * and wraps it in a Swift class that can directly interop with C++ (`HybridNativeLoggerSpec_cxx`)
14
+ *
15
+ * This is generated by Nitrogen and will initialize the class specified
16
+ * in the `"autolinking"` property of `nitro.json` (in this case, `NativeLogger`).
17
+ */
18
+ public static func createNativeLogger() -> bridge.std__shared_ptr_HybridNativeLoggerSpec_ {
19
+ let hybridObject = NativeLogger()
20
+ return { () -> bridge.std__shared_ptr_HybridNativeLoggerSpec_ in
21
+ let __cxxWrapped = hybridObject.getCxxWrapper()
22
+ return __cxxWrapped.getCxxPart()
23
+ }()
24
+ }
25
+ }
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridNativeLoggerSpecSwift.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "HybridNativeLoggerSpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::nativelogger {
11
+ } // namespace margelo::nitro::nativelogger
@@ -0,0 +1,92 @@
1
+ ///
2
+ /// HybridNativeLoggerSpecSwift.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include "HybridNativeLoggerSpec.hpp"
11
+
12
+ // Forward declaration of `HybridNativeLoggerSpec_cxx` to properly resolve imports.
13
+ namespace ReactNativeNativeLogger { class HybridNativeLoggerSpec_cxx; }
14
+
15
+
16
+
17
+ #include <string>
18
+ #include <vector>
19
+ #include <NitroModules/Promise.hpp>
20
+
21
+ #include "ReactNativeNativeLogger-Swift-Cxx-Umbrella.hpp"
22
+
23
+ namespace margelo::nitro::nativelogger {
24
+
25
+ /**
26
+ * The C++ part of HybridNativeLoggerSpec_cxx.swift.
27
+ *
28
+ * HybridNativeLoggerSpecSwift (C++) accesses HybridNativeLoggerSpec_cxx (Swift), and might
29
+ * contain some additional bridging code for C++ <> Swift interop.
30
+ *
31
+ * Since this obviously introduces an overhead, I hope at some point in
32
+ * the future, HybridNativeLoggerSpec_cxx can directly inherit from the C++ class HybridNativeLoggerSpec
33
+ * to simplify the whole structure and memory management.
34
+ */
35
+ class HybridNativeLoggerSpecSwift: public virtual HybridNativeLoggerSpec {
36
+ public:
37
+ // Constructor from a Swift instance
38
+ explicit HybridNativeLoggerSpecSwift(const ReactNativeNativeLogger::HybridNativeLoggerSpec_cxx& swiftPart):
39
+ HybridObject(HybridNativeLoggerSpec::TAG),
40
+ _swiftPart(swiftPart) { }
41
+
42
+ public:
43
+ // Get the Swift part
44
+ inline ReactNativeNativeLogger::HybridNativeLoggerSpec_cxx& getSwiftPart() noexcept {
45
+ return _swiftPart;
46
+ }
47
+
48
+ public:
49
+ inline size_t getExternalMemorySize() noexcept override {
50
+ return _swiftPart.getMemorySize();
51
+ }
52
+ void dispose() noexcept override {
53
+ _swiftPart.dispose();
54
+ }
55
+ std::string toString() override {
56
+ return _swiftPart.toString();
57
+ }
58
+
59
+ public:
60
+ // Properties
61
+
62
+
63
+ public:
64
+ // Methods
65
+ inline void write(double level, const std::string& msg) override {
66
+ auto __result = _swiftPart.write(std::forward<decltype(level)>(level), msg);
67
+ if (__result.hasError()) [[unlikely]] {
68
+ std::rethrow_exception(__result.error());
69
+ }
70
+ }
71
+ inline std::shared_ptr<Promise<std::vector<std::string>>> getLogFilePaths() override {
72
+ auto __result = _swiftPart.getLogFilePaths();
73
+ if (__result.hasError()) [[unlikely]] {
74
+ std::rethrow_exception(__result.error());
75
+ }
76
+ auto __value = std::move(__result.value());
77
+ return __value;
78
+ }
79
+ inline std::shared_ptr<Promise<void>> deleteLogFiles() override {
80
+ auto __result = _swiftPart.deleteLogFiles();
81
+ if (__result.hasError()) [[unlikely]] {
82
+ std::rethrow_exception(__result.error());
83
+ }
84
+ auto __value = std::move(__result.value());
85
+ return __value;
86
+ }
87
+
88
+ private:
89
+ ReactNativeNativeLogger::HybridNativeLoggerSpec_cxx _swiftPart;
90
+ };
91
+
92
+ } // namespace margelo::nitro::nativelogger
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Wraps a Swift `() -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void {
16
+ public typealias bridge = margelo.nitro.nativelogger.bridge.swift
17
+
18
+ private let closure: () -> Void
19
+
20
+ public init(_ closure: @escaping () -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call() -> Void {
26
+ self.closure()
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void {
45
+ return Unmanaged<Func_void>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_std__exception_ptr.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Wraps a Swift `(_ error: Error) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_std__exception_ptr {
16
+ public typealias bridge = margelo.nitro.nativelogger.bridge.swift
17
+
18
+ private let closure: (_ error: Error) -> Void
19
+
20
+ public init(_ closure: @escaping (_ error: Error) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(error: std.exception_ptr) -> Void {
26
+ self.closure(RuntimeError.from(cppError: error))
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
45
+ return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_std__vector_std__string_.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Wraps a Swift `(_ value: [String]) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_std__vector_std__string_ {
16
+ public typealias bridge = margelo.nitro.nativelogger.bridge.swift
17
+
18
+ private let closure: (_ value: [String]) -> Void
19
+
20
+ public init(_ closure: @escaping (_ value: [String]) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(value: bridge.std__vector_std__string_) -> Void {
26
+ self.closure(value.map({ __item in String(__item) }))
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_std__vector_std__string_`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_std__string_>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_std__string_ {
45
+ return Unmanaged<Func_void_std__vector_std__string_>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -0,0 +1,58 @@
1
+ ///
2
+ /// HybridNativeLoggerSpec.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /// See ``HybridNativeLoggerSpec``
12
+ public protocol HybridNativeLoggerSpec_protocol: HybridObject {
13
+ // Properties
14
+
15
+
16
+ // Methods
17
+ func write(level: Double, msg: String) throws -> Void
18
+ func getLogFilePaths() throws -> Promise<[String]>
19
+ func deleteLogFiles() throws -> Promise<Void>
20
+ }
21
+
22
+ public extension HybridNativeLoggerSpec_protocol {
23
+ /// Default implementation of ``HybridObject.toString``
24
+ func toString() -> String {
25
+ return "[HybridObject NativeLogger]"
26
+ }
27
+ }
28
+
29
+ /// See ``HybridNativeLoggerSpec``
30
+ open class HybridNativeLoggerSpec_base {
31
+ private weak var cxxWrapper: HybridNativeLoggerSpec_cxx? = nil
32
+ public init() { }
33
+ public func getCxxWrapper() -> HybridNativeLoggerSpec_cxx {
34
+ #if DEBUG
35
+ guard self is HybridNativeLoggerSpec else {
36
+ fatalError("`self` is not a `HybridNativeLoggerSpec`! Did you accidentally inherit from `HybridNativeLoggerSpec_base` instead of `HybridNativeLoggerSpec`?")
37
+ }
38
+ #endif
39
+ if let cxxWrapper = self.cxxWrapper {
40
+ return cxxWrapper
41
+ } else {
42
+ let cxxWrapper = HybridNativeLoggerSpec_cxx(self as! HybridNativeLoggerSpec)
43
+ self.cxxWrapper = cxxWrapper
44
+ return cxxWrapper
45
+ }
46
+ }
47
+ }
48
+
49
+ /**
50
+ * A Swift base-protocol representing the NativeLogger HybridObject.
51
+ * Implement this protocol to create Swift-based instances of NativeLogger.
52
+ * ```swift
53
+ * class HybridNativeLogger : HybridNativeLoggerSpec {
54
+ * // ...
55
+ * }
56
+ * ```
57
+ */
58
+ public typealias HybridNativeLoggerSpec = HybridNativeLoggerSpec_protocol & HybridNativeLoggerSpec_base