react-native-nitro-logger 0.1.0
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.
- package/LICENSE +20 -0
- package/NitroLogger.podspec +29 -0
- package/README.md +214 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +124 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +11 -0
- package/android/src/main/java/com/margelo/nitro/nitrologger/AndroidPlatformIo.kt +100 -0
- package/android/src/main/java/com/margelo/nitro/nitrologger/HybridFileSink.kt +292 -0
- package/android/src/main/java/com/margelo/nitro/nitrologger/HybridNativeConsoleSink.kt +23 -0
- package/android/src/main/java/com/margelo/nitro/nitrologger/LogFileWriter.kt +1328 -0
- package/android/src/main/java/com/margelo/nitro/nitrologger/LogRotationPolicy.kt +186 -0
- package/android/src/main/java/com/margelo/nitro/nitrologger/LogSecureFile.kt +80 -0
- package/android/src/main/java/com/margelo/nitro/nitrologger/LogWriterRegistry.kt +420 -0
- package/android/src/main/java/com/margelo/nitro/nitrologger/NativeConsoleWriter.kt +237 -0
- package/android/src/main/java/com/margelo/nitro/nitrologger/NitroLoggerPackage.kt +22 -0
- package/android/src/main/java/com/margelo/nitro/nitrologger/PlatformIo.kt +165 -0
- package/docs/PARITY.md +330 -0
- package/docs/PRIVACY.md +341 -0
- package/eslint-plugin/README.md +238 -0
- package/eslint-plugin/index.js +62 -0
- package/eslint-plugin/rules/literal-subsystem.js +102 -0
- package/eslint-plugin/rules/no-computed-metadata-key.js +174 -0
- package/eslint-plugin/rules/no-derived-correlation.js +171 -0
- package/eslint-plugin/rules/no-dynamic-message.js +60 -0
- package/eslint-plugin/shared.js +1948 -0
- package/ios/Gzip.swift +203 -0
- package/ios/HybridFileSink.swift +291 -0
- package/ios/HybridNativeConsoleSink.swift +20 -0
- package/ios/LogFileWriter.swift +1280 -0
- package/ios/LogSecureFile.swift +296 -0
- package/ios/LogWriterRegistry.swift +444 -0
- package/ios/NativeConsoleWriter.swift +180 -0
- package/lib/module/Logger.js +381 -0
- package/lib/module/Logger.js.map +1 -0
- package/lib/module/ScopedLogger.js +70 -0
- package/lib/module/ScopedLogger.js.map +1 -0
- package/lib/module/config.js +23 -0
- package/lib/module/config.js.map +1 -0
- package/lib/module/destinations/Batcher.js +647 -0
- package/lib/module/destinations/Batcher.js.map +1 -0
- package/lib/module/destinations/ConsoleDestination.js +51 -0
- package/lib/module/destinations/ConsoleDestination.js.map +1 -0
- package/lib/module/destinations/FileDestination.js +360 -0
- package/lib/module/destinations/FileDestination.js.map +1 -0
- package/lib/module/destinations/NativeConsoleDestination.js +170 -0
- package/lib/module/destinations/NativeConsoleDestination.js.map +1 -0
- package/lib/module/destinations/types.js +4 -0
- package/lib/module/destinations/types.js.map +1 -0
- package/lib/module/formatters/DefaultFormatter.js +136 -0
- package/lib/module/formatters/DefaultFormatter.js.map +1 -0
- package/lib/module/formatters/JsonLinesFormatter.js +162 -0
- package/lib/module/formatters/JsonLinesFormatter.js.map +1 -0
- package/lib/module/formatters/timestamp.js +15 -0
- package/lib/module/formatters/timestamp.js.map +1 -0
- package/lib/module/formatters/types.js +4 -0
- package/lib/module/formatters/types.js.map +1 -0
- package/lib/module/index.js +31 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/integrations/appState.js +81 -0
- package/lib/module/integrations/appState.js.map +1 -0
- package/lib/module/integrations/errorHandler.js +166 -0
- package/lib/module/integrations/errorHandler.js.map +1 -0
- package/lib/module/integrations/sanitizeError.js +238 -0
- package/lib/module/integrations/sanitizeError.js.map +1 -0
- package/lib/module/levels.js +35 -0
- package/lib/module/levels.js.map +1 -0
- package/lib/module/metadata.js +52 -0
- package/lib/module/metadata.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/privacy.js +349 -0
- package/lib/module/privacy.js.map +1 -0
- package/lib/module/specs/FileSink.nitro.js +4 -0
- package/lib/module/specs/FileSink.nitro.js.map +1 -0
- package/lib/module/specs/NativeConsoleSink.nitro.js +4 -0
- package/lib/module/specs/NativeConsoleSink.nitro.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utf8.js +42 -0
- package/lib/module/utf8.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/Logger.d.ts +122 -0
- package/lib/typescript/src/Logger.d.ts.map +1 -0
- package/lib/typescript/src/ScopedLogger.d.ts +36 -0
- package/lib/typescript/src/ScopedLogger.d.ts.map +1 -0
- package/lib/typescript/src/config.d.ts +12 -0
- package/lib/typescript/src/config.d.ts.map +1 -0
- package/lib/typescript/src/destinations/Batcher.d.ts +244 -0
- package/lib/typescript/src/destinations/Batcher.d.ts.map +1 -0
- package/lib/typescript/src/destinations/ConsoleDestination.d.ts +27 -0
- package/lib/typescript/src/destinations/ConsoleDestination.d.ts.map +1 -0
- package/lib/typescript/src/destinations/FileDestination.d.ts +200 -0
- package/lib/typescript/src/destinations/FileDestination.d.ts.map +1 -0
- package/lib/typescript/src/destinations/NativeConsoleDestination.d.ts +86 -0
- package/lib/typescript/src/destinations/NativeConsoleDestination.d.ts.map +1 -0
- package/lib/typescript/src/destinations/types.d.ts +19 -0
- package/lib/typescript/src/destinations/types.d.ts.map +1 -0
- package/lib/typescript/src/formatters/DefaultFormatter.d.ts +22 -0
- package/lib/typescript/src/formatters/DefaultFormatter.d.ts.map +1 -0
- package/lib/typescript/src/formatters/JsonLinesFormatter.d.ts +73 -0
- package/lib/typescript/src/formatters/JsonLinesFormatter.d.ts.map +1 -0
- package/lib/typescript/src/formatters/timestamp.d.ts +6 -0
- package/lib/typescript/src/formatters/timestamp.d.ts.map +1 -0
- package/lib/typescript/src/formatters/types.d.ts +27 -0
- package/lib/typescript/src/formatters/types.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +34 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/integrations/appState.d.ts +33 -0
- package/lib/typescript/src/integrations/appState.d.ts.map +1 -0
- package/lib/typescript/src/integrations/errorHandler.d.ts +55 -0
- package/lib/typescript/src/integrations/errorHandler.d.ts.map +1 -0
- package/lib/typescript/src/integrations/sanitizeError.d.ts +89 -0
- package/lib/typescript/src/integrations/sanitizeError.d.ts.map +1 -0
- package/lib/typescript/src/levels.d.ts +9 -0
- package/lib/typescript/src/levels.d.ts.map +1 -0
- package/lib/typescript/src/metadata.d.ts +23 -0
- package/lib/typescript/src/metadata.d.ts.map +1 -0
- package/lib/typescript/src/privacy.d.ts +103 -0
- package/lib/typescript/src/privacy.d.ts.map +1 -0
- package/lib/typescript/src/specs/FileSink.nitro.d.ts +131 -0
- package/lib/typescript/src/specs/FileSink.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeConsoleSink.nitro.d.ts +21 -0
- package/lib/typescript/src/specs/NativeConsoleSink.nitro.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +37 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utf8.d.ts +15 -0
- package/lib/typescript/src/utf8.d.ts.map +1 -0
- package/nitro.json +33 -0
- package/nitrogen/generated/android/c++/JAppendResult.hpp +79 -0
- package/nitrogen/generated/android/c++/JClearOutcome.hpp +88 -0
- package/nitrogen/generated/android/c++/JFlushOutcome.hpp +81 -0
- package/nitrogen/generated/android/c++/JHybridFileSinkSpec.cpp +120 -0
- package/nitrogen/generated/android/c++/JHybridFileSinkSpec.hpp +69 -0
- package/nitrogen/generated/android/c++/JHybridNativeConsoleSinkSpec.cpp +71 -0
- package/nitrogen/generated/android/c++/JHybridNativeConsoleSinkSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JRejectReason.hpp +64 -0
- package/nitrogen/generated/android/c++/JRotationConfig.hpp +77 -0
- package/nitrogen/generated/android/c++/JSinkStatus.hpp +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrologger/AppendResult.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrologger/ClearOutcome.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrologger/FlushOutcome.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrologger/HybridFileSinkSpec.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrologger/HybridNativeConsoleSinkSpec.kt +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrologger/RejectReason.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrologger/RotationConfig.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrologger/SinkStatus.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrologger/nitrologgerOnLoad.kt +35 -0
- package/nitrogen/generated/android/nitrologger+autolinking.cmake +83 -0
- package/nitrogen/generated/android/nitrologger+autolinking.gradle +27 -0
- package/nitrogen/generated/android/nitrologgerOnLoad.cpp +70 -0
- package/nitrogen/generated/android/nitrologgerOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/NitroLogger+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroLogger-Swift-Cxx-Bridge.cpp +50 -0
- package/nitrogen/generated/ios/NitroLogger-Swift-Cxx-Bridge.hpp +216 -0
- package/nitrogen/generated/ios/NitroLogger-Swift-Cxx-Umbrella.hpp +69 -0
- package/nitrogen/generated/ios/NitroLoggerAutolinking.mm +41 -0
- package/nitrogen/generated/ios/NitroLoggerAutolinking.swift +38 -0
- package/nitrogen/generated/ios/c++/HybridFileSinkSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridFileSinkSpecSwift.hpp +150 -0
- package/nitrogen/generated/ios/c++/HybridNativeConsoleSinkSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNativeConsoleSinkSpecSwift.hpp +87 -0
- package/nitrogen/generated/ios/swift/AppendResult.swift +60 -0
- package/nitrogen/generated/ios/swift/ClearOutcome.swift +50 -0
- package/nitrogen/generated/ios/swift/FlushOutcome.swift +59 -0
- package/nitrogen/generated/ios/swift/HybridFileSinkSpec.swift +61 -0
- package/nitrogen/generated/ios/swift/HybridFileSinkSpec_cxx.swift +227 -0
- package/nitrogen/generated/ios/swift/HybridNativeConsoleSinkSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridNativeConsoleSinkSpec_cxx.swift +148 -0
- package/nitrogen/generated/ios/swift/RejectReason.swift +48 -0
- package/nitrogen/generated/ios/swift/RotationConfig.swift +93 -0
- package/nitrogen/generated/ios/swift/SinkStatus.swift +44 -0
- package/nitrogen/generated/shared/c++/AppendResult.hpp +105 -0
- package/nitrogen/generated/shared/c++/ClearOutcome.hpp +96 -0
- package/nitrogen/generated/shared/c++/FlushOutcome.hpp +107 -0
- package/nitrogen/generated/shared/c++/HybridFileSinkSpec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridFileSinkSpec.hpp +84 -0
- package/nitrogen/generated/shared/c++/HybridNativeConsoleSinkSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridNativeConsoleSinkSpec.hpp +64 -0
- package/nitrogen/generated/shared/c++/RejectReason.hpp +84 -0
- package/nitrogen/generated/shared/c++/RotationConfig.hpp +103 -0
- package/nitrogen/generated/shared/c++/SinkStatus.hpp +95 -0
- package/package.json +151 -0
- package/src/Logger.ts +417 -0
- package/src/ScopedLogger.ts +94 -0
- package/src/config.ts +25 -0
- package/src/destinations/Batcher.ts +805 -0
- package/src/destinations/ConsoleDestination.ts +60 -0
- package/src/destinations/FileDestination.ts +473 -0
- package/src/destinations/NativeConsoleDestination.ts +220 -0
- package/src/destinations/types.ts +19 -0
- package/src/formatters/DefaultFormatter.ts +150 -0
- package/src/formatters/JsonLinesFormatter.ts +195 -0
- package/src/formatters/timestamp.ts +12 -0
- package/src/formatters/types.ts +29 -0
- package/src/index.tsx +106 -0
- package/src/integrations/appState.ts +111 -0
- package/src/integrations/errorHandler.ts +223 -0
- package/src/integrations/sanitizeError.ts +287 -0
- package/src/levels.ts +35 -0
- package/src/metadata.ts +52 -0
- package/src/privacy.ts +389 -0
- package/src/specs/FileSink.nitro.ts +144 -0
- package/src/specs/NativeConsoleSink.nitro.ts +21 -0
- package/src/types.ts +45 -0
- package/src/utf8.ts +39 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroLogger-Swift-Cxx-Bridge.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `AppendResult` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nitrologger { struct AppendResult; }
|
|
13
|
+
// Forward declaration of `ClearOutcome` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::nitrologger { struct ClearOutcome; }
|
|
15
|
+
// Forward declaration of `FlushOutcome` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitrologger { struct FlushOutcome; }
|
|
17
|
+
// Forward declaration of `HybridFileSinkSpec` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitrologger { class HybridFileSinkSpec; }
|
|
19
|
+
// Forward declaration of `HybridNativeConsoleSinkSpec` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nitrologger { class HybridNativeConsoleSinkSpec; }
|
|
21
|
+
// Forward declaration of `RejectReason` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitrologger { enum class RejectReason; }
|
|
23
|
+
// Forward declaration of `RotationConfig` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::nitrologger { struct RotationConfig; }
|
|
25
|
+
// Forward declaration of `SinkStatus` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::nitrologger { struct SinkStatus; }
|
|
27
|
+
|
|
28
|
+
// Forward declarations of Swift defined types
|
|
29
|
+
// Forward declaration of `HybridFileSinkSpec_cxx` to properly resolve imports.
|
|
30
|
+
namespace NitroLogger { class HybridFileSinkSpec_cxx; }
|
|
31
|
+
// Forward declaration of `HybridNativeConsoleSinkSpec_cxx` to properly resolve imports.
|
|
32
|
+
namespace NitroLogger { class HybridNativeConsoleSinkSpec_cxx; }
|
|
33
|
+
|
|
34
|
+
// Include C++ defined types
|
|
35
|
+
#include "AppendResult.hpp"
|
|
36
|
+
#include "ClearOutcome.hpp"
|
|
37
|
+
#include "FlushOutcome.hpp"
|
|
38
|
+
#include "HybridFileSinkSpec.hpp"
|
|
39
|
+
#include "HybridNativeConsoleSinkSpec.hpp"
|
|
40
|
+
#include "RejectReason.hpp"
|
|
41
|
+
#include "RotationConfig.hpp"
|
|
42
|
+
#include "SinkStatus.hpp"
|
|
43
|
+
#include <NitroModules/Result.hpp>
|
|
44
|
+
#include <exception>
|
|
45
|
+
#include <memory>
|
|
46
|
+
#include <optional>
|
|
47
|
+
#include <string>
|
|
48
|
+
#include <vector>
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
52
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
53
|
+
*/
|
|
54
|
+
namespace margelo::nitro::nitrologger::bridge::swift {
|
|
55
|
+
|
|
56
|
+
// pragma MARK: std::optional<double>
|
|
57
|
+
/**
|
|
58
|
+
* Specialized version of `std::optional<double>`.
|
|
59
|
+
*/
|
|
60
|
+
using std__optional_double_ = std::optional<double>;
|
|
61
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
62
|
+
return std::optional<double>(value);
|
|
63
|
+
}
|
|
64
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
65
|
+
return optional.has_value();
|
|
66
|
+
}
|
|
67
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
68
|
+
return optional.value();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// pragma MARK: std::optional<RotationConfig>
|
|
72
|
+
/**
|
|
73
|
+
* Specialized version of `std::optional<RotationConfig>`.
|
|
74
|
+
*/
|
|
75
|
+
using std__optional_RotationConfig_ = std::optional<RotationConfig>;
|
|
76
|
+
inline std::optional<RotationConfig> create_std__optional_RotationConfig_(const RotationConfig& value) noexcept {
|
|
77
|
+
return std::optional<RotationConfig>(value);
|
|
78
|
+
}
|
|
79
|
+
inline bool has_value_std__optional_RotationConfig_(const std::optional<RotationConfig>& optional) noexcept {
|
|
80
|
+
return optional.has_value();
|
|
81
|
+
}
|
|
82
|
+
inline RotationConfig get_std__optional_RotationConfig_(const std::optional<RotationConfig>& optional) noexcept {
|
|
83
|
+
return optional.value();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// pragma MARK: std::optional<bool>
|
|
87
|
+
/**
|
|
88
|
+
* Specialized version of `std::optional<bool>`.
|
|
89
|
+
*/
|
|
90
|
+
using std__optional_bool_ = std::optional<bool>;
|
|
91
|
+
inline std::optional<bool> create_std__optional_bool_(const bool& value) noexcept {
|
|
92
|
+
return std::optional<bool>(value);
|
|
93
|
+
}
|
|
94
|
+
inline bool has_value_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
95
|
+
return optional.has_value();
|
|
96
|
+
}
|
|
97
|
+
inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
98
|
+
return optional.value();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// pragma MARK: std::optional<RejectReason>
|
|
102
|
+
/**
|
|
103
|
+
* Specialized version of `std::optional<RejectReason>`.
|
|
104
|
+
*/
|
|
105
|
+
using std__optional_RejectReason_ = std::optional<RejectReason>;
|
|
106
|
+
inline std::optional<RejectReason> create_std__optional_RejectReason_(const RejectReason& value) noexcept {
|
|
107
|
+
return std::optional<RejectReason>(value);
|
|
108
|
+
}
|
|
109
|
+
inline bool has_value_std__optional_RejectReason_(const std::optional<RejectReason>& optional) noexcept {
|
|
110
|
+
return optional.has_value();
|
|
111
|
+
}
|
|
112
|
+
inline RejectReason get_std__optional_RejectReason_(const std::optional<RejectReason>& optional) noexcept {
|
|
113
|
+
return optional.value();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// pragma MARK: std::vector<std::string>
|
|
117
|
+
/**
|
|
118
|
+
* Specialized version of `std::vector<std::string>`.
|
|
119
|
+
*/
|
|
120
|
+
using std__vector_std__string_ = std::vector<std::string>;
|
|
121
|
+
inline std::vector<std::string> create_std__vector_std__string_(size_t size) noexcept {
|
|
122
|
+
std::vector<std::string> vector;
|
|
123
|
+
vector.reserve(size);
|
|
124
|
+
return vector;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// pragma MARK: std::shared_ptr<HybridFileSinkSpec>
|
|
128
|
+
/**
|
|
129
|
+
* Specialized version of `std::shared_ptr<HybridFileSinkSpec>`.
|
|
130
|
+
*/
|
|
131
|
+
using std__shared_ptr_HybridFileSinkSpec_ = std::shared_ptr<HybridFileSinkSpec>;
|
|
132
|
+
std::shared_ptr<HybridFileSinkSpec> create_std__shared_ptr_HybridFileSinkSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
133
|
+
void* NON_NULL get_std__shared_ptr_HybridFileSinkSpec_(std__shared_ptr_HybridFileSinkSpec_ cppType);
|
|
134
|
+
|
|
135
|
+
// pragma MARK: std::weak_ptr<HybridFileSinkSpec>
|
|
136
|
+
using std__weak_ptr_HybridFileSinkSpec_ = std::weak_ptr<HybridFileSinkSpec>;
|
|
137
|
+
inline std__weak_ptr_HybridFileSinkSpec_ weakify_std__shared_ptr_HybridFileSinkSpec_(const std::shared_ptr<HybridFileSinkSpec>& strong) noexcept { return strong; }
|
|
138
|
+
|
|
139
|
+
// pragma MARK: Result<void>
|
|
140
|
+
using Result_void_ = Result<void>;
|
|
141
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
142
|
+
return Result<void>::withValue();
|
|
143
|
+
}
|
|
144
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
145
|
+
return Result<void>::withError(error);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// pragma MARK: Result<AppendResult>
|
|
149
|
+
using Result_AppendResult_ = Result<AppendResult>;
|
|
150
|
+
inline Result_AppendResult_ create_Result_AppendResult_(const AppendResult& value) noexcept {
|
|
151
|
+
return Result<AppendResult>::withValue(value);
|
|
152
|
+
}
|
|
153
|
+
inline Result_AppendResult_ create_Result_AppendResult_(const std::exception_ptr& error) noexcept {
|
|
154
|
+
return Result<AppendResult>::withError(error);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// pragma MARK: Result<SinkStatus>
|
|
158
|
+
using Result_SinkStatus_ = Result<SinkStatus>;
|
|
159
|
+
inline Result_SinkStatus_ create_Result_SinkStatus_(const SinkStatus& value) noexcept {
|
|
160
|
+
return Result<SinkStatus>::withValue(value);
|
|
161
|
+
}
|
|
162
|
+
inline Result_SinkStatus_ create_Result_SinkStatus_(const std::exception_ptr& error) noexcept {
|
|
163
|
+
return Result<SinkStatus>::withError(error);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// pragma MARK: Result<FlushOutcome>
|
|
167
|
+
using Result_FlushOutcome_ = Result<FlushOutcome>;
|
|
168
|
+
inline Result_FlushOutcome_ create_Result_FlushOutcome_(const FlushOutcome& value) noexcept {
|
|
169
|
+
return Result<FlushOutcome>::withValue(value);
|
|
170
|
+
}
|
|
171
|
+
inline Result_FlushOutcome_ create_Result_FlushOutcome_(const std::exception_ptr& error) noexcept {
|
|
172
|
+
return Result<FlushOutcome>::withError(error);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// pragma MARK: Result<std::vector<std::string>>
|
|
176
|
+
using Result_std__vector_std__string__ = Result<std::vector<std::string>>;
|
|
177
|
+
inline Result_std__vector_std__string__ create_Result_std__vector_std__string__(const std::vector<std::string>& value) noexcept {
|
|
178
|
+
return Result<std::vector<std::string>>::withValue(value);
|
|
179
|
+
}
|
|
180
|
+
inline Result_std__vector_std__string__ create_Result_std__vector_std__string__(const std::exception_ptr& error) noexcept {
|
|
181
|
+
return Result<std::vector<std::string>>::withError(error);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// pragma MARK: Result<ClearOutcome>
|
|
185
|
+
using Result_ClearOutcome_ = Result<ClearOutcome>;
|
|
186
|
+
inline Result_ClearOutcome_ create_Result_ClearOutcome_(const ClearOutcome& value) noexcept {
|
|
187
|
+
return Result<ClearOutcome>::withValue(value);
|
|
188
|
+
}
|
|
189
|
+
inline Result_ClearOutcome_ create_Result_ClearOutcome_(const std::exception_ptr& error) noexcept {
|
|
190
|
+
return Result<ClearOutcome>::withError(error);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// pragma MARK: std::vector<double>
|
|
194
|
+
/**
|
|
195
|
+
* Specialized version of `std::vector<double>`.
|
|
196
|
+
*/
|
|
197
|
+
using std__vector_double_ = std::vector<double>;
|
|
198
|
+
inline std::vector<double> create_std__vector_double_(size_t size) noexcept {
|
|
199
|
+
std::vector<double> vector;
|
|
200
|
+
vector.reserve(size);
|
|
201
|
+
return vector;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// pragma MARK: std::shared_ptr<HybridNativeConsoleSinkSpec>
|
|
205
|
+
/**
|
|
206
|
+
* Specialized version of `std::shared_ptr<HybridNativeConsoleSinkSpec>`.
|
|
207
|
+
*/
|
|
208
|
+
using std__shared_ptr_HybridNativeConsoleSinkSpec_ = std::shared_ptr<HybridNativeConsoleSinkSpec>;
|
|
209
|
+
std::shared_ptr<HybridNativeConsoleSinkSpec> create_std__shared_ptr_HybridNativeConsoleSinkSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
210
|
+
void* NON_NULL get_std__shared_ptr_HybridNativeConsoleSinkSpec_(std__shared_ptr_HybridNativeConsoleSinkSpec_ cppType);
|
|
211
|
+
|
|
212
|
+
// pragma MARK: std::weak_ptr<HybridNativeConsoleSinkSpec>
|
|
213
|
+
using std__weak_ptr_HybridNativeConsoleSinkSpec_ = std::weak_ptr<HybridNativeConsoleSinkSpec>;
|
|
214
|
+
inline std__weak_ptr_HybridNativeConsoleSinkSpec_ weakify_std__shared_ptr_HybridNativeConsoleSinkSpec_(const std::shared_ptr<HybridNativeConsoleSinkSpec>& strong) noexcept { return strong; }
|
|
215
|
+
|
|
216
|
+
} // namespace margelo::nitro::nitrologger::bridge::swift
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroLogger-Swift-Cxx-Umbrella.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `AppendResult` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nitrologger { struct AppendResult; }
|
|
13
|
+
// Forward declaration of `ClearOutcome` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::nitrologger { struct ClearOutcome; }
|
|
15
|
+
// Forward declaration of `FlushOutcome` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitrologger { struct FlushOutcome; }
|
|
17
|
+
// Forward declaration of `HybridFileSinkSpec` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitrologger { class HybridFileSinkSpec; }
|
|
19
|
+
// Forward declaration of `HybridNativeConsoleSinkSpec` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nitrologger { class HybridNativeConsoleSinkSpec; }
|
|
21
|
+
// Forward declaration of `RejectReason` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitrologger { enum class RejectReason; }
|
|
23
|
+
// Forward declaration of `RotationConfig` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::nitrologger { struct RotationConfig; }
|
|
25
|
+
// Forward declaration of `SinkStatus` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::nitrologger { struct SinkStatus; }
|
|
27
|
+
|
|
28
|
+
// Include C++ defined types
|
|
29
|
+
#include "AppendResult.hpp"
|
|
30
|
+
#include "ClearOutcome.hpp"
|
|
31
|
+
#include "FlushOutcome.hpp"
|
|
32
|
+
#include "HybridFileSinkSpec.hpp"
|
|
33
|
+
#include "HybridNativeConsoleSinkSpec.hpp"
|
|
34
|
+
#include "RejectReason.hpp"
|
|
35
|
+
#include "RotationConfig.hpp"
|
|
36
|
+
#include "SinkStatus.hpp"
|
|
37
|
+
#include <NitroModules/Result.hpp>
|
|
38
|
+
#include <exception>
|
|
39
|
+
#include <memory>
|
|
40
|
+
#include <optional>
|
|
41
|
+
#include <string>
|
|
42
|
+
#include <vector>
|
|
43
|
+
|
|
44
|
+
// C++ helpers for Swift
|
|
45
|
+
#include "NitroLogger-Swift-Cxx-Bridge.hpp"
|
|
46
|
+
|
|
47
|
+
// Common C++ types used in Swift
|
|
48
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
49
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
50
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
51
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
52
|
+
|
|
53
|
+
// Forward declarations of Swift defined types
|
|
54
|
+
// Forward declaration of `HybridFileSinkSpec_cxx` to properly resolve imports.
|
|
55
|
+
namespace NitroLogger { class HybridFileSinkSpec_cxx; }
|
|
56
|
+
// Forward declaration of `HybridNativeConsoleSinkSpec_cxx` to properly resolve imports.
|
|
57
|
+
namespace NitroLogger { class HybridNativeConsoleSinkSpec_cxx; }
|
|
58
|
+
|
|
59
|
+
// Include Swift defined types
|
|
60
|
+
#if __has_include("NitroLogger-Swift.h")
|
|
61
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
62
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroLogger".
|
|
63
|
+
#include "NitroLogger-Swift.h"
|
|
64
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
65
|
+
#elif __has_include(<NitroLogger/NitroLogger-Swift.h>)
|
|
66
|
+
#include <NitroLogger/NitroLogger-Swift.h>
|
|
67
|
+
#else
|
|
68
|
+
#error NitroLogger's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroLogger", and try building the app first.
|
|
69
|
+
#endif
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroLoggerAutolinking.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "NitroLogger-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridFileSinkSpecSwift.hpp"
|
|
14
|
+
#include "HybridNativeConsoleSinkSpecSwift.hpp"
|
|
15
|
+
|
|
16
|
+
@interface NitroLoggerAutolinking : NSObject
|
|
17
|
+
@end
|
|
18
|
+
|
|
19
|
+
@implementation NitroLoggerAutolinking
|
|
20
|
+
|
|
21
|
+
+ (void) load {
|
|
22
|
+
using namespace margelo::nitro;
|
|
23
|
+
using namespace margelo::nitro::nitrologger;
|
|
24
|
+
|
|
25
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
26
|
+
"FileSink",
|
|
27
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
28
|
+
std::shared_ptr<HybridFileSinkSpec> hybridObject = NitroLogger::NitroLoggerAutolinking::createFileSink();
|
|
29
|
+
return hybridObject;
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
33
|
+
"NativeConsoleSink",
|
|
34
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
35
|
+
std::shared_ptr<HybridNativeConsoleSinkSpec> hybridObject = NitroLogger::NitroLoggerAutolinking::createNativeConsoleSink();
|
|
36
|
+
return hybridObject;
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroLoggerAutolinking.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class NitroLoggerAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.nitrologger.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createFileSink() -> bridge.std__shared_ptr_HybridFileSinkSpec_ {
|
|
16
|
+
let hybridObject = HybridFileSink()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridFileSinkSpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isFileSinkRecyclable() -> Bool {
|
|
24
|
+
return HybridFileSink.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public static func createNativeConsoleSink() -> bridge.std__shared_ptr_HybridNativeConsoleSinkSpec_ {
|
|
28
|
+
let hybridObject = HybridNativeConsoleSink()
|
|
29
|
+
return { () -> bridge.std__shared_ptr_HybridNativeConsoleSinkSpec_ in
|
|
30
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
31
|
+
return __cxxWrapped.getCxxPart()
|
|
32
|
+
}()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public static func isNativeConsoleSinkRecyclable() -> Bool {
|
|
36
|
+
return HybridNativeConsoleSink.self is any RecyclableView.Type
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridFileSinkSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridFileSinkSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitrologger {
|
|
11
|
+
} // namespace margelo::nitro::nitrologger
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridFileSinkSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridFileSinkSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridFileSinkSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace NitroLogger { class HybridFileSinkSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `RotationConfig` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitrologger { struct RotationConfig; }
|
|
17
|
+
// Forward declaration of `AppendResult` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitrologger { struct AppendResult; }
|
|
19
|
+
// Forward declaration of `RejectReason` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nitrologger { enum class RejectReason; }
|
|
21
|
+
// Forward declaration of `SinkStatus` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitrologger { struct SinkStatus; }
|
|
23
|
+
// Forward declaration of `FlushOutcome` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::nitrologger { struct FlushOutcome; }
|
|
25
|
+
// Forward declaration of `ClearOutcome` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::nitrologger { struct ClearOutcome; }
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
#include "RotationConfig.hpp"
|
|
30
|
+
#include <optional>
|
|
31
|
+
#include "AppendResult.hpp"
|
|
32
|
+
#include "RejectReason.hpp"
|
|
33
|
+
#include "SinkStatus.hpp"
|
|
34
|
+
#include "FlushOutcome.hpp"
|
|
35
|
+
#include <vector>
|
|
36
|
+
#include "ClearOutcome.hpp"
|
|
37
|
+
|
|
38
|
+
#include "NitroLogger-Swift-Cxx-Umbrella.hpp"
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro::nitrologger {
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The C++ part of HybridFileSinkSpec_cxx.swift.
|
|
44
|
+
*
|
|
45
|
+
* HybridFileSinkSpecSwift (C++) accesses HybridFileSinkSpec_cxx (Swift), and might
|
|
46
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
47
|
+
*
|
|
48
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
49
|
+
* the future, HybridFileSinkSpec_cxx can directly inherit from the C++ class HybridFileSinkSpec
|
|
50
|
+
* to simplify the whole structure and memory management.
|
|
51
|
+
*/
|
|
52
|
+
class HybridFileSinkSpecSwift: public virtual HybridFileSinkSpec {
|
|
53
|
+
public:
|
|
54
|
+
// Constructor from a Swift instance
|
|
55
|
+
explicit HybridFileSinkSpecSwift(const NitroLogger::HybridFileSinkSpec_cxx& swiftPart):
|
|
56
|
+
HybridObject(HybridFileSinkSpec::TAG),
|
|
57
|
+
_swiftPart(swiftPart) { }
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
// Get the Swift part
|
|
61
|
+
inline NitroLogger::HybridFileSinkSpec_cxx& getSwiftPart() noexcept {
|
|
62
|
+
return _swiftPart;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public:
|
|
66
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
67
|
+
return _swiftPart.getMemorySize();
|
|
68
|
+
}
|
|
69
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
70
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridFileSinkSpecSwift>(other)) {
|
|
71
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
void dispose() noexcept override {
|
|
76
|
+
_swiftPart.dispose();
|
|
77
|
+
}
|
|
78
|
+
std::string toString() override {
|
|
79
|
+
return _swiftPart.toString();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public:
|
|
83
|
+
// Properties
|
|
84
|
+
inline std::string getDefaultLogDirectory() noexcept override {
|
|
85
|
+
auto __result = _swiftPart.getDefaultLogDirectory();
|
|
86
|
+
return __result;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public:
|
|
90
|
+
// Methods
|
|
91
|
+
inline void open(const std::string& path, const std::optional<RotationConfig>& rotation, std::optional<bool> lineFramed) override {
|
|
92
|
+
auto __result = _swiftPart.open(path, rotation, lineFramed);
|
|
93
|
+
if (__result.hasError()) [[unlikely]] {
|
|
94
|
+
std::rethrow_exception(__result.error());
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
inline AppendResult appendBatch(const std::string& batch, double entryCount) override {
|
|
98
|
+
auto __result = _swiftPart.appendBatch(batch, std::forward<decltype(entryCount)>(entryCount));
|
|
99
|
+
if (__result.hasError()) [[unlikely]] {
|
|
100
|
+
std::rethrow_exception(__result.error());
|
|
101
|
+
}
|
|
102
|
+
auto __value = std::move(__result.value());
|
|
103
|
+
return __value;
|
|
104
|
+
}
|
|
105
|
+
inline SinkStatus getStatus() override {
|
|
106
|
+
auto __result = _swiftPart.getStatus();
|
|
107
|
+
if (__result.hasError()) [[unlikely]] {
|
|
108
|
+
std::rethrow_exception(__result.error());
|
|
109
|
+
}
|
|
110
|
+
auto __value = std::move(__result.value());
|
|
111
|
+
return __value;
|
|
112
|
+
}
|
|
113
|
+
inline FlushOutcome flush(double deadlineMs) override {
|
|
114
|
+
auto __result = _swiftPart.flush(std::forward<decltype(deadlineMs)>(deadlineMs));
|
|
115
|
+
if (__result.hasError()) [[unlikely]] {
|
|
116
|
+
std::rethrow_exception(__result.error());
|
|
117
|
+
}
|
|
118
|
+
auto __value = std::move(__result.value());
|
|
119
|
+
return __value;
|
|
120
|
+
}
|
|
121
|
+
inline FlushOutcome close(double deadlineMs) override {
|
|
122
|
+
auto __result = _swiftPart.close(std::forward<decltype(deadlineMs)>(deadlineMs));
|
|
123
|
+
if (__result.hasError()) [[unlikely]] {
|
|
124
|
+
std::rethrow_exception(__result.error());
|
|
125
|
+
}
|
|
126
|
+
auto __value = std::move(__result.value());
|
|
127
|
+
return __value;
|
|
128
|
+
}
|
|
129
|
+
inline std::vector<std::string> getLogFilePaths() override {
|
|
130
|
+
auto __result = _swiftPart.getLogFilePaths();
|
|
131
|
+
if (__result.hasError()) [[unlikely]] {
|
|
132
|
+
std::rethrow_exception(__result.error());
|
|
133
|
+
}
|
|
134
|
+
auto __value = std::move(__result.value());
|
|
135
|
+
return __value;
|
|
136
|
+
}
|
|
137
|
+
inline ClearOutcome clearLogs(double deadlineMs) override {
|
|
138
|
+
auto __result = _swiftPart.clearLogs(std::forward<decltype(deadlineMs)>(deadlineMs));
|
|
139
|
+
if (__result.hasError()) [[unlikely]] {
|
|
140
|
+
std::rethrow_exception(__result.error());
|
|
141
|
+
}
|
|
142
|
+
auto __value = std::move(__result.value());
|
|
143
|
+
return __value;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private:
|
|
147
|
+
NitroLogger::HybridFileSinkSpec_cxx _swiftPart;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
} // namespace margelo::nitro::nitrologger
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeConsoleSinkSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridNativeConsoleSinkSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitrologger {
|
|
11
|
+
} // namespace margelo::nitro::nitrologger
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNativeConsoleSinkSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridNativeConsoleSinkSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridNativeConsoleSinkSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace NitroLogger { class HybridNativeConsoleSinkSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#include <string>
|
|
18
|
+
#include <vector>
|
|
19
|
+
|
|
20
|
+
#include "NitroLogger-Swift-Cxx-Umbrella.hpp"
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::nitrologger {
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The C++ part of HybridNativeConsoleSinkSpec_cxx.swift.
|
|
26
|
+
*
|
|
27
|
+
* HybridNativeConsoleSinkSpecSwift (C++) accesses HybridNativeConsoleSinkSpec_cxx (Swift), and might
|
|
28
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
29
|
+
*
|
|
30
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
31
|
+
* the future, HybridNativeConsoleSinkSpec_cxx can directly inherit from the C++ class HybridNativeConsoleSinkSpec
|
|
32
|
+
* to simplify the whole structure and memory management.
|
|
33
|
+
*/
|
|
34
|
+
class HybridNativeConsoleSinkSpecSwift: public virtual HybridNativeConsoleSinkSpec {
|
|
35
|
+
public:
|
|
36
|
+
// Constructor from a Swift instance
|
|
37
|
+
explicit HybridNativeConsoleSinkSpecSwift(const NitroLogger::HybridNativeConsoleSinkSpec_cxx& swiftPart):
|
|
38
|
+
HybridObject(HybridNativeConsoleSinkSpec::TAG),
|
|
39
|
+
_swiftPart(swiftPart) { }
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
// Get the Swift part
|
|
43
|
+
inline NitroLogger::HybridNativeConsoleSinkSpec_cxx& getSwiftPart() noexcept {
|
|
44
|
+
return _swiftPart;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
49
|
+
return _swiftPart.getMemorySize();
|
|
50
|
+
}
|
|
51
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
52
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridNativeConsoleSinkSpecSwift>(other)) {
|
|
53
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
void dispose() noexcept override {
|
|
58
|
+
_swiftPart.dispose();
|
|
59
|
+
}
|
|
60
|
+
std::string toString() override {
|
|
61
|
+
return _swiftPart.toString();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
// Properties
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
public:
|
|
69
|
+
// Methods
|
|
70
|
+
inline void install(const std::string& subsystem, const std::string& category) override {
|
|
71
|
+
auto __result = _swiftPart.install(subsystem, category);
|
|
72
|
+
if (__result.hasError()) [[unlikely]] {
|
|
73
|
+
std::rethrow_exception(__result.error());
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
inline void logBatch(const std::vector<double>& levels, const std::vector<std::string>& messages) override {
|
|
77
|
+
auto __result = _swiftPart.logBatch(levels, messages);
|
|
78
|
+
if (__result.hasError()) [[unlikely]] {
|
|
79
|
+
std::rethrow_exception(__result.error());
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private:
|
|
84
|
+
NitroLogger::HybridNativeConsoleSinkSpec_cxx _swiftPart;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
} // namespace margelo::nitro::nitrologger
|