Merge branch 'master' into maharrim/exceptions
This commit is contained in:
Коммит
b2017bbd65
|
@ -1,20 +1,21 @@
|
|||
package com.microsoft.applications.events.maesdktest;
|
||||
|
||||
import static org.hamcrest.Matchers.isA;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
|
||||
import com.microsoft.applications.events.HttpClient;
|
||||
import com.microsoft.applications.events.ILogger;
|
||||
import com.microsoft.applications.events.LogManager;
|
||||
import com.microsoft.applications.events.OfflineRoom;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
|
@ -22,31 +23,46 @@ import static org.junit.Assert.fail;
|
|||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class SDKUnitNativeTest extends MaeUnitLogger {
|
||||
public void log_failure(String filename, int line, String summary)
|
||||
{
|
||||
fail(String.format("%s:%d: %s", filename, line, summary));
|
||||
}
|
||||
public void log_failure(String filename, int line, String summary) {
|
||||
fail(String.format("%s:%d: %s", filename, line, summary));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
|
||||
assertEquals("com.microsoft.applications.events.maesdktest", appContext.getPackageName());
|
||||
}
|
||||
assertEquals("com.microsoft.applications.events.maesdktest", appContext.getPackageName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void runNativeTests() {
|
||||
System.loadLibrary("native-lib");
|
||||
System.loadLibrary("maesdk");
|
||||
@Test
|
||||
public void runNativeTests() {
|
||||
System.loadLibrary("native-lib");
|
||||
System.loadLibrary("maesdk");
|
||||
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
HttpClient client = new HttpClient(appContext);
|
||||
OfflineRoom.connectContext(appContext);
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
HttpClient client = new HttpClient(appContext);
|
||||
OfflineRoom.connectContext(appContext);
|
||||
|
||||
TestStub stub = new TestStub();
|
||||
int result = stub.runNativeTests(this);
|
||||
assertEquals(0, result);
|
||||
Log.i("MAE", "Test finished");
|
||||
}
|
||||
TestStub stub = new TestStub();
|
||||
int result = stub.runNativeTests(this);
|
||||
assertEquals(0, result);
|
||||
Log.i("MAE", "Test finished");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void wrapperLogManager() {
|
||||
System.loadLibrary("maesdk");
|
||||
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
HttpClient client = new HttpClient(appContext);
|
||||
OfflineRoom.connectContext(appContext);
|
||||
|
||||
final String token =
|
||||
"0123456789abcdef0123456789abcdef-01234567-0123-0123-0123-0123456789ab-0123";
|
||||
|
||||
ILogger logger = LogManager.initialize(token);
|
||||
assertThat(logger, isA(ILogger.class));
|
||||
LogManager.flushAndTeardown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ public class LogManager {
|
|||
return new Logger(logger);
|
||||
}
|
||||
|
||||
|
||||
private static native int nativeFlushAndTeardown();
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
package com.microsoft.applications.events;
|
||||
|
||||
class StatusValues {
|
||||
static final int VALUE_EFAIL = -1;
|
||||
static final int VALUE_SUCCESS = 0;
|
||||
static final int VALUE_EPERM = 1;
|
||||
static final int VALUE_EALREADY = 103;
|
||||
static final int VALUE_ENOSYS = 40;
|
||||
static final int VALUE_ENOTSUP = 129;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The status enum corresponding to the native API execution status_t.
|
||||
|
@ -67,4 +60,14 @@ public enum Status {
|
|||
throw new IllegalArgumentException("Unsupported value: " + value);
|
||||
}
|
||||
}
|
||||
|
||||
class StatusValues {
|
||||
static final int VALUE_EFAIL = -1;
|
||||
static final int VALUE_SUCCESS = 0;
|
||||
static final int VALUE_EPERM = 1;
|
||||
static final int VALUE_EALREADY = 103;
|
||||
static final int VALUE_ENOSYS = 40;
|
||||
static final int VALUE_ENOTSUP = 129;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#ifndef MAT_LOGMANAGER_HPP
|
||||
#define MAT_LOGMANAGER_HPP
|
||||
|
||||
#include "ctmacros.hpp"
|
||||
#include "CommonFields.h"
|
||||
#include "ctmacros.hpp"
|
||||
|
||||
#if (HAVE_EXCEPTIONS)
|
||||
#include <exception>
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4459 4100 4121 4068)
|
||||
#pragma warning(disable : 4459 4100 4121 4068)
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic push
|
||||
|
@ -19,8 +19,10 @@
|
|||
|
||||
#ifdef _MANAGED
|
||||
#include <msclr/lock.h>
|
||||
public ref class LogManagerLock {
|
||||
public:
|
||||
public
|
||||
ref class LogManagerLock
|
||||
{
|
||||
public:
|
||||
static Object ^ lock = gcnew Object();
|
||||
};
|
||||
#else
|
||||
|
@ -29,71 +31,71 @@ public:
|
|||
|
||||
#include "LogManagerProvider.hpp"
|
||||
|
||||
#define LM_SAFE_CALL(method , ... ) \
|
||||
{ \
|
||||
LM_LOCKGUARD(stateLock()); \
|
||||
if (nullptr != instance) \
|
||||
{ \
|
||||
instance-> method ( __VA_ARGS__); \
|
||||
return STATUS_SUCCESS; \
|
||||
} \
|
||||
return STATUS_EFAIL; \
|
||||
#define LM_SAFE_CALL(method, ...) \
|
||||
{ \
|
||||
LM_LOCKGUARD(stateLock()); \
|
||||
if (nullptr != instance) \
|
||||
{ \
|
||||
instance->method(__VA_ARGS__); \
|
||||
return STATUS_SUCCESS; \
|
||||
} \
|
||||
return STATUS_EFAIL; \
|
||||
}
|
||||
|
||||
#define LM_SAFE_CALL_RETURN(method , ... ) \
|
||||
{ \
|
||||
LM_LOCKGUARD(stateLock()); \
|
||||
if (nullptr != instance) \
|
||||
{ \
|
||||
return instance-> method ( __VA_ARGS__);\
|
||||
} \
|
||||
#define LM_SAFE_CALL_RETURN(method, ...) \
|
||||
{ \
|
||||
LM_LOCKGUARD(stateLock()); \
|
||||
if (nullptr != instance) \
|
||||
{ \
|
||||
return instance->method(__VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LM_SAFE_CALL_STR(method , ... ) \
|
||||
{ \
|
||||
LM_LOCKGUARD(stateLock()); \
|
||||
if (nullptr != instance) \
|
||||
{ \
|
||||
return instance-> method ( __VA_ARGS__);\
|
||||
} \
|
||||
return ""; \
|
||||
#define LM_SAFE_CALL_STR(method, ...) \
|
||||
{ \
|
||||
LM_LOCKGUARD(stateLock()); \
|
||||
if (nullptr != instance) \
|
||||
{ \
|
||||
return instance->method(__VA_ARGS__); \
|
||||
} \
|
||||
return ""; \
|
||||
}
|
||||
|
||||
#define LM_SAFE_CALL_PTR(method , ... ) \
|
||||
{ \
|
||||
LM_LOCKGUARD(stateLock()); \
|
||||
if (nullptr != instance) \
|
||||
{ \
|
||||
return instance-> method ( __VA_ARGS__);\
|
||||
} \
|
||||
return nullptr; \
|
||||
#define LM_SAFE_CALL_PTR(method, ...) \
|
||||
{ \
|
||||
LM_LOCKGUARD(stateLock()); \
|
||||
if (nullptr != instance) \
|
||||
{ \
|
||||
return instance->method(__VA_ARGS__); \
|
||||
} \
|
||||
return nullptr; \
|
||||
}
|
||||
|
||||
#define LM_SAFE_CALL_PTRREF(method , ... ) \
|
||||
{ \
|
||||
LM_LOCKGUARD(stateLock()); \
|
||||
if (nullptr != instance) \
|
||||
{ \
|
||||
return &(instance-> method ( __VA_ARGS__));\
|
||||
} \
|
||||
return nullptr; \
|
||||
#define LM_SAFE_CALL_PTRREF(method, ...) \
|
||||
{ \
|
||||
LM_LOCKGUARD(stateLock()); \
|
||||
if (nullptr != instance) \
|
||||
{ \
|
||||
return &(instance->method(__VA_ARGS__)); \
|
||||
} \
|
||||
return nullptr; \
|
||||
}
|
||||
|
||||
#define LM_SAFE_CALL_VOID(method , ... ) \
|
||||
{ \
|
||||
LM_LOCKGUARD(stateLock()); \
|
||||
if (nullptr != instance) \
|
||||
{ \
|
||||
instance-> method ( __VA_ARGS__); \
|
||||
return; \
|
||||
} \
|
||||
#define LM_SAFE_CALL_VOID(method, ...) \
|
||||
{ \
|
||||
LM_LOCKGUARD(stateLock()); \
|
||||
if (nullptr != instance) \
|
||||
{ \
|
||||
instance->method(__VA_ARGS__); \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
|
||||
#ifdef _MANAGED
|
||||
#define LM_LOCKGUARD(macro_mutex) msclr::lock TOKENPASTE2(__guard_, __LINE__)(LogManagerLock::lock);
|
||||
#else
|
||||
#define LM_LOCKGUARD(macro_mutex) \
|
||||
std::lock_guard<std::recursive_mutex> TOKENPASTE2(__guard_, __LINE__) (macro_mutex);
|
||||
#define LM_LOCKGUARD(macro_mutex) \
|
||||
std::lock_guard<std::recursive_mutex> TOKENPASTE2(__guard_, __LINE__)(macro_mutex);
|
||||
#endif
|
||||
|
||||
namespace ARIASDK_NS_BEGIN
|
||||
|
@ -101,9 +103,12 @@ namespace ARIASDK_NS_BEGIN
|
|||
#if (HAVE_EXCEPTIONS)
|
||||
class LogManagerNotInitializedException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
public:
|
||||
LogManagerNotInitializedException(const char* message) noexcept
|
||||
: std::runtime_error(message) { }
|
||||
:
|
||||
std::runtime_error(message)
|
||||
{
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -112,39 +117,39 @@ namespace ARIASDK_NS_BEGIN
|
|||
/// is running in "host" mode and all LogController methods should be accessible to the
|
||||
/// caller.
|
||||
/// </summary>
|
||||
static constexpr const char * HOST_MODE = "hostMode";
|
||||
static constexpr const char* HOST_MODE = "hostMode";
|
||||
|
||||
/// <summary>
|
||||
/// This class is used to manage the Events logging system
|
||||
/// </summary>
|
||||
template <class ModuleConfiguration> class LogManagerBase
|
||||
template <class ModuleConfiguration>
|
||||
class LogManagerBase
|
||||
{
|
||||
static_assert(std::is_base_of<ILogConfiguration, ModuleConfiguration>::value, "ModuleConfiguration must derive from LogConfiguration");
|
||||
|
||||
public:
|
||||
public:
|
||||
using basetype = LogManagerBase<ModuleConfiguration>;
|
||||
|
||||
protected:
|
||||
|
||||
protected:
|
||||
/// <summary>
|
||||
/// LogManagerBase constructor
|
||||
/// </summary>
|
||||
LogManagerBase() {};
|
||||
LogManagerBase(){};
|
||||
|
||||
/// <summary>
|
||||
/// LogManager copy constructor
|
||||
/// </summary>
|
||||
LogManagerBase(const LogManagerBase&) {};
|
||||
LogManagerBase(const LogManagerBase&){};
|
||||
|
||||
/// <summary>
|
||||
/// [not implemented] LogManager assignment operator
|
||||
/// </summary>
|
||||
LogManagerBase& operator=(const LogManagerBase&) {};
|
||||
LogManagerBase& operator=(const LogManagerBase&){};
|
||||
|
||||
/// <summary>
|
||||
/// LogManager destructor
|
||||
/// </summary>
|
||||
virtual ~LogManagerBase() {};
|
||||
virtual ~LogManagerBase(){};
|
||||
|
||||
#ifndef _MANAGED
|
||||
/// <summary>
|
||||
|
@ -167,7 +172,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
/// <summary>
|
||||
/// Concrete instance for servicing all singleton calls
|
||||
/// </summary>
|
||||
static ILogManager* instance;
|
||||
static ILogManager* instance;
|
||||
|
||||
/// <summary>
|
||||
/// Debug event source associated with this singleton
|
||||
|
@ -181,11 +186,10 @@ namespace ARIASDK_NS_BEGIN
|
|||
static const char* GetPrimaryToken()
|
||||
{
|
||||
ILogConfiguration& config = GetLogConfiguration();
|
||||
return (const char *)(config[CFG_STR_PRIMARY_TOKEN]);
|
||||
return (const char*)(config[CFG_STR_PRIMARY_TOKEN]);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Returns this module LogConfiguration
|
||||
/// </summary>
|
||||
|
@ -201,7 +205,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
/// <returns>A logger instance instantiated with the default tenantToken.</returns>
|
||||
static ILogger* Initialize()
|
||||
{
|
||||
return Initialize(std::string {});
|
||||
return Initialize(std::string{});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -211,7 +215,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
/// <returns>A logger instance instantiated with the tenantToken.</returns>
|
||||
inline static ILogger* Initialize(const std::string& tenantToken)
|
||||
{
|
||||
return Initialize(tenantToken, GetLogConfiguration());
|
||||
return Initialize(tenantToken, GetLogConfiguration());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -222,8 +226,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
/// <returns>A logger instance instantiated with the tenantToken.</returns>
|
||||
static ILogger* Initialize(
|
||||
const std::string& tenantToken,
|
||||
ILogConfiguration& configuration
|
||||
)
|
||||
ILogConfiguration& configuration)
|
||||
{
|
||||
LM_LOCKGUARD(stateLock());
|
||||
ILogConfiguration& currentConfig = GetLogConfiguration();
|
||||
|
@ -232,12 +235,12 @@ namespace ARIASDK_NS_BEGIN
|
|||
// Copy alternate configuration into currentConfig
|
||||
if (&configuration != ¤tConfig)
|
||||
{
|
||||
for (const auto &kv : *configuration)
|
||||
for (const auto& kv : *configuration)
|
||||
{
|
||||
currentConfig[kv.first.c_str()] = kv.second;
|
||||
}
|
||||
|
||||
for (const auto &kv : configuration.GetModules())
|
||||
for (const auto& kv : configuration.GetModules())
|
||||
{
|
||||
currentConfig.AddModule(kv.first.c_str(), kv.second);
|
||||
}
|
||||
|
@ -254,7 +257,8 @@ namespace ARIASDK_NS_BEGIN
|
|||
instance->AttachEventSource(GetDebugEventSource());
|
||||
return instance->GetLogger(currentConfig[CFG_STR_PRIMARY_TOKEN]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// TODO: [MG] - decide what to do if someone's doing re-Initialize.
|
||||
// For now Re-initialize works as GetLogger with an alternate token.
|
||||
// We may decide to assert(tenantToken==primaryToken) ...
|
||||
|
@ -272,7 +276,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
static status_t FlushAndTeardown()
|
||||
{
|
||||
LM_LOCKGUARD(stateLock());
|
||||
#ifdef NO_TEARDOWN // Avoid destroying our ILogManager instance on teardown
|
||||
#ifdef NO_TEARDOWN // Avoid destroying our ILogManager instance on teardown
|
||||
LM_SAFE_CALL(Flush);
|
||||
LM_SAFE_CALL(UploadNow);
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -312,12 +316,12 @@ namespace ARIASDK_NS_BEGIN
|
|||
LM_LOCKGUARD(stateLock());
|
||||
if (isHost())
|
||||
LM_SAFE_CALL(GetLogController()->UploadNow);
|
||||
return STATUS_EPERM; // Permission denied
|
||||
return STATUS_EPERM; // Permission denied
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flush any pending telemetry events in memory to disk to reduce possible data loss as seen necessary.
|
||||
/// This function can be very expensive so should be used sparingly. OS will block the calling thread
|
||||
/// This function can be very expensive so should be used sparingly. OS will block the calling thread
|
||||
/// and might flush the global file buffers, i.e. all buffered filesystem data, to disk, which could be
|
||||
/// time consuming.
|
||||
/// </summary>
|
||||
|
@ -325,7 +329,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
{
|
||||
if (isHost())
|
||||
LM_SAFE_CALL(GetLogController()->Flush);
|
||||
return STATUS_EPERM; // Permission denied
|
||||
return STATUS_EPERM; // Permission denied
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -336,7 +340,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
{
|
||||
if (isHost())
|
||||
LM_SAFE_CALL(GetLogController()->PauseTransmission);
|
||||
return STATUS_EPERM; // Permission denied
|
||||
return STATUS_EPERM; // Permission denied
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -346,13 +350,13 @@ namespace ARIASDK_NS_BEGIN
|
|||
{
|
||||
if (isHost())
|
||||
LM_SAFE_CALL(GetLogController()->ResumeTransmission);
|
||||
return STATUS_EPERM; // Permission denied
|
||||
return STATUS_EPERM; // Permission denied
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets transmit profile for event transmission to one of the built-in profiles.
|
||||
/// A transmit profile is a collection of hardware and system settings (like network connectivity, power state)
|
||||
/// based on which to determine how events are to be transmitted.
|
||||
/// based on which to determine how events are to be transmitted.
|
||||
/// </summary>
|
||||
/// <param name="profile">Transmit profile</param>
|
||||
/// <returns>This function doesn't return any value because it always succeeds.</returns>
|
||||
|
@ -360,13 +364,13 @@ namespace ARIASDK_NS_BEGIN
|
|||
{
|
||||
if (isHost())
|
||||
LM_SAFE_CALL(GetLogController()->SetTransmitProfile, profile);
|
||||
return STATUS_EPERM; // Permission denied
|
||||
return STATUS_EPERM; // Permission denied
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets transmit profile for event transmission.
|
||||
/// A transmit profile is a collection of hardware and system settings (like network connectivity, power state)
|
||||
/// based on which to determine how events are to be transmitted.
|
||||
/// based on which to determine how events are to be transmitted.
|
||||
/// </summary>
|
||||
/// <param name="profile">Transmit profile</param>
|
||||
/// <returns>true if profile is successfully applied, false otherwise</returns>
|
||||
|
@ -374,7 +378,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
{
|
||||
if (isHost())
|
||||
LM_SAFE_CALL(GetLogController()->SetTransmitProfile, profile);
|
||||
return STATUS_EPERM; // Permission denied
|
||||
return STATUS_EPERM; // Permission denied
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -386,7 +390,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
{
|
||||
if (isHost())
|
||||
LM_SAFE_CALL(GetLogController()->LoadTransmitProfiles, profiles_json);
|
||||
return STATUS_EPERM; // Permission denied
|
||||
return STATUS_EPERM; // Permission denied
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -396,7 +400,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
{
|
||||
if (isHost())
|
||||
LM_SAFE_CALL(GetLogController()->ResetTransmitProfiles);
|
||||
return STATUS_EPERM; // Permission denied
|
||||
return STATUS_EPERM; // Permission denied
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -407,9 +411,9 @@ namespace ARIASDK_NS_BEGIN
|
|||
LM_SAFE_CALL_STR(GetTransmitProfileName);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve an ISemanticContext interface through which to specify context information
|
||||
/// Retrieve an ISemanticContext interface through which to specify context information
|
||||
/// such as device, system, hardware and user information.
|
||||
/// Context information set via this API will apply to all logger instance unless they
|
||||
/// Context information set via this API will apply to all logger instance unless they
|
||||
/// are overwritten by individual logger instance.
|
||||
/// </summary>
|
||||
/// <returns>ISemanticContext interface pointer</returns>
|
||||
|
@ -418,7 +422,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
|
||||
/// <summary>
|
||||
/// Adds or overrides a property of the custom context for the telemetry logging system.
|
||||
/// Context information set here applies to events generated by all ILogger instances
|
||||
/// Context information set here applies to events generated by all ILogger instances
|
||||
/// unless it is overwritten on a particular ILogger instance.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the context property</param>
|
||||
|
@ -429,13 +433,13 @@ namespace ARIASDK_NS_BEGIN
|
|||
|
||||
/// <summary>
|
||||
/// Adds or overrides a property of the custom context for the telemetry logging system.
|
||||
/// Context information set here applies to events generated by all ILogger instances
|
||||
/// Context information set here applies to events generated by all ILogger instances
|
||||
/// unless it is overwritten on a particular ILogger instance.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the context property</param>
|
||||
/// <param name="value">Value of the context property</param>
|
||||
/// <param name='piiKind'>PIIKind of the context with PiiKind_None as the default</param>
|
||||
static status_t SetContext(const std::string& name, const char *value, PiiKind piiKind = PiiKind_None)
|
||||
static status_t SetContext(const std::string& name, const char* value, PiiKind piiKind = PiiKind_None)
|
||||
LM_SAFE_CALL(SetContext, name, std::string(value), piiKind);
|
||||
|
||||
/// <summary>
|
||||
|
@ -460,7 +464,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
/// </summary>
|
||||
/// <param name="name">Name of the property</param>
|
||||
/// <param name="value">8-bit Integer value of the property</param>
|
||||
static status_t SetContext(const std::string& name, int8_t value, PiiKind piiKind = PiiKind_None)
|
||||
static status_t SetContext(const std::string& name, int8_t value, PiiKind piiKind = PiiKind_None)
|
||||
LM_SAFE_CALL(SetContext, name, (int64_t)value, piiKind);
|
||||
|
||||
/// <summary>
|
||||
|
@ -487,7 +491,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
/// </summary>
|
||||
/// <param name="name">Name of the property</param>
|
||||
/// <param name="value">8-bit unsigned integer value of the property</param>
|
||||
static status_t SetContext(const std::string& name, uint8_t value, PiiKind piiKind = PiiKind_None)
|
||||
static status_t SetContext(const std::string& name, uint8_t value, PiiKind piiKind = PiiKind_None)
|
||||
LM_SAFE_CALL(SetContext, name, (int64_t)value, piiKind);
|
||||
|
||||
/// <summary>
|
||||
|
@ -593,7 +597,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
/// <summary>
|
||||
/// Add Debug callback
|
||||
/// </summary>
|
||||
static void AddEventListener(DebugEventType type, DebugEventListener &listener)
|
||||
static void AddEventListener(DebugEventType type, DebugEventListener& listener)
|
||||
{
|
||||
GetDebugEventSource().AddEventListener(type, listener);
|
||||
}
|
||||
|
@ -601,7 +605,7 @@ namespace ARIASDK_NS_BEGIN
|
|||
/// <summary>
|
||||
/// Remove Debug callback
|
||||
/// </summary>
|
||||
static void RemoveEventListener(DebugEventType type, DebugEventListener &listener)
|
||||
static void RemoveEventListener(DebugEventType type, DebugEventListener& listener)
|
||||
{
|
||||
GetDebugEventSource().RemoveEventListener(type, listener);
|
||||
}
|
||||
|
@ -688,18 +692,21 @@ namespace ARIASDK_NS_BEGIN
|
|||
// that causes improper global static templated member initialization:
|
||||
// https://developercommunity.visualstudio.com/content/problem/134886/initialization-of-template-static-variable-wrong.html
|
||||
//
|
||||
#define DEFINE_LOGMANAGER(LogManagerClass, LogConfigurationClass) \
|
||||
ILogManager* LogManagerClass::instance = nullptr;
|
||||
#elif (defined(__APPLE__) || defined(ANDROID)) && defined(MAT_USE_WEAK_LOGMANAGER)
|
||||
#define DEFINE_LOGMANAGER(LogManagerClass, LogConfigurationClass) \
|
||||
template<> __attribute__((weak)) ILogManager* LogManagerBase<LogConfigurationClass>::instance {};
|
||||
#define DEFINE_LOGMANAGER(LogManagerClass, LogConfigurationClass) \
|
||||
ILogManager* LogManagerClass::instance = nullptr;
|
||||
#elif defined(__APPLE__) && defined(MAT_USE_WEAK_LOGMANAGER)
|
||||
#define DEFINE_LOGMANAGER(LogManagerClass, LogConfigurationClass) \
|
||||
template <> \
|
||||
__attribute__((weak)) ILogManager* LogManagerBase<LogConfigurationClass>::instance{};
|
||||
#else
|
||||
// ISO C++ -compliant declaration
|
||||
#define DEFINE_LOGMANAGER(LogManagerClass, LogConfigurationClass) \
|
||||
template<> ILogManager* LogManagerBase<LogConfigurationClass>::instance {};
|
||||
#define DEFINE_LOGMANAGER(LogManagerClass, LogConfigurationClass) \
|
||||
template <> \
|
||||
ILogManager* LogManagerBase<LogConfigurationClass>::instance{};
|
||||
#endif
|
||||
|
||||
} ARIASDK_NS_END
|
||||
}
|
||||
ARIASDK_NS_END
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
#include "JniConvertors.hpp"
|
||||
#include "LogManager.hpp"
|
||||
#include "WrapperLogManager.hpp"
|
||||
#include "modules/dataviewer/DefaultDataViewer.hpp"
|
||||
|
||||
using namespace MAT;
|
||||
LOGMANAGER_INSTANCE
|
||||
|
||||
// The static instance of WrapperLogManager is instantiated in LogManager_jni.cpp
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_com_microsoft_applications_events_LogManager_initializeDiagnosticDataViewer(
|
||||
JNIEXPORT jboolean JNICALL Java_com_microsoft_applications_events_LogManager_initializeDiagnosticDataViewer(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jstring jstrMachineIdentifier,
|
||||
|
@ -24,18 +26,19 @@ JNIEXPORT jboolean JNICALL Java_com_microsoft_applications_events_LogManager_ini
|
|||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_microsoft_applications_events_LogManager_disableViewer(
|
||||
JNIEXPORT void JNICALL Java_com_microsoft_applications_events_LogManager_disableViewer(
|
||||
JNIEnv* env,
|
||||
jclass /* this */) {
|
||||
LogManager::GetDataViewerCollection().UnregisterAllViewers();
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_com_microsoft_applications_events_LogManager_isViewerEnabled(
|
||||
JNIEXPORT jboolean JNICALL Java_com_microsoft_applications_events_LogManager_isViewerEnabled(
|
||||
JNIEnv* env,
|
||||
jclass /* this */) {
|
||||
return LogManager::GetDataViewerCollection().IsViewerEnabled();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
|
@ -1,196 +1,220 @@
|
|||
#include "JniConvertors.hpp"
|
||||
#include "LogManager.hpp"
|
||||
#include "LogManagerBase.hpp"
|
||||
#include "WrapperLogManager.hpp"
|
||||
|
||||
using namespace MAT;
|
||||
LOGMANAGER_INSTANCE
|
||||
|
||||
template <>
|
||||
ILogManager* LogManagerBase<WrapperConfig>::instance{};
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeInitializeWithoutTenantToken(
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeInitializeWithoutTenantToken(
|
||||
JNIEnv* /* env */,
|
||||
jclass /* this */) {
|
||||
ILogger* logger = LogManager::Initialize();
|
||||
return reinterpret_cast<jlong>(logger);
|
||||
}
|
||||
jclass /* this */)
|
||||
{
|
||||
ILogger* logger = WrapperLogManager::Initialize();
|
||||
return reinterpret_cast<jlong>(logger);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeInitializeWithTenantToken(
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeInitializeWithTenantToken(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jstring jTenantToken) {
|
||||
auto tenantToken = JStringToStdString(env, jTenantToken);
|
||||
ILogger* logger = LogManager::Initialize(tenantToken);
|
||||
return reinterpret_cast<jlong>(logger);
|
||||
}
|
||||
jstring jTenantToken)
|
||||
{
|
||||
auto tenantToken = JStringToStdString(env, jTenantToken);
|
||||
ILogger* logger = WrapperLogManager::Initialize(tenantToken);
|
||||
return reinterpret_cast<jlong>(logger);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeFlushAndTeardown(
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeFlushAndTeardown(
|
||||
JNIEnv* /* env */,
|
||||
jclass /* this */) {
|
||||
return static_cast<jint>(LogManager::FlushAndTeardown());
|
||||
}
|
||||
jclass /* this */)
|
||||
{
|
||||
return static_cast<jint>(WrapperLogManager::FlushAndTeardown());
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeFlush(
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeFlush(
|
||||
JNIEnv* /* env */,
|
||||
jclass /* this */) {
|
||||
return static_cast<jint>(LogManager::Flush());
|
||||
}
|
||||
jclass /* this */)
|
||||
{
|
||||
return static_cast<jint>(WrapperLogManager::Flush());
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeUploadNow(
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeUploadNow(
|
||||
JNIEnv* /* env */,
|
||||
jclass /* this */) {
|
||||
return static_cast<jint>(LogManager::UploadNow());
|
||||
}
|
||||
jclass /* this */)
|
||||
{
|
||||
return static_cast<jint>(WrapperLogManager::UploadNow());
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativePauseTransmission(
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativePauseTransmission(
|
||||
JNIEnv* /* env */,
|
||||
jclass /* this */) {
|
||||
return static_cast<jint>(LogManager::PauseTransmission());
|
||||
}
|
||||
jclass /* this */)
|
||||
{
|
||||
return static_cast<jint>(WrapperLogManager::PauseTransmission());
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeResumeTransmission(
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeResumeTransmission(
|
||||
JNIEnv* /* env */,
|
||||
jclass /* this */) {
|
||||
return static_cast<jint>(LogManager::ResumeTransmission());
|
||||
}
|
||||
jclass /* this */)
|
||||
{
|
||||
return static_cast<jint>(WrapperLogManager::ResumeTransmission());
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetIntTransmitProfile(
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetIntTransmitProfile(
|
||||
JNIEnv* /* env */,
|
||||
jclass /* this */,
|
||||
jint jProfile) {
|
||||
return static_cast<jint>(LogManager::SetTransmitProfile(
|
||||
jint jProfile)
|
||||
{
|
||||
return static_cast<jint>(WrapperLogManager::SetTransmitProfile(
|
||||
static_cast<TransmitProfile>(jProfile)));
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetTransmitProfileString(
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetTransmitProfileString(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jstring jstrProfile) {
|
||||
return static_cast<jint>(LogManager::SetTransmitProfile(JStringToStdString(env, jstrProfile)));
|
||||
}
|
||||
jstring jstrProfile)
|
||||
{
|
||||
return static_cast<jint>(WrapperLogManager::SetTransmitProfile(JStringToStdString(env, jstrProfile)));
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeLoadTransmitProfilesString(
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeLoadTransmitProfilesString(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jstring jstrProfilesJson) {
|
||||
return static_cast<jint>(LogManager::LoadTransmitProfiles(JStringToStdString(env, jstrProfilesJson)));
|
||||
}
|
||||
jstring jstrProfilesJson)
|
||||
{
|
||||
return static_cast<jint>(WrapperLogManager::LoadTransmitProfiles(JStringToStdString(env, jstrProfilesJson)));
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeResetTransmitProfiles(
|
||||
JNIEXPORT jint JNICALL Java_com_microsoft_applications_events_LogManager_nativeResetTransmitProfiles(
|
||||
JNIEnv* /* env */,
|
||||
jclass /* this */) {
|
||||
return static_cast<jint>(LogManager::ResetTransmitProfiles());
|
||||
}
|
||||
jclass /* this */)
|
||||
{
|
||||
return static_cast<jint>(WrapperLogManager::ResetTransmitProfiles());
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_com_microsoft_applications_events_LogManager_getTransmitProfileName(
|
||||
JNIEXPORT jstring JNICALL Java_com_microsoft_applications_events_LogManager_getTransmitProfileName(
|
||||
JNIEnv* env,
|
||||
jclass /* this */) {
|
||||
std::string profileName = LogManager::GetTransmitProfileName();
|
||||
return static_cast<jstring>(env->NewStringUTF(profileName.c_str()));
|
||||
}
|
||||
jclass /* this */)
|
||||
{
|
||||
std::string profileName = WrapperLogManager::GetTransmitProfileName();
|
||||
return static_cast<jstring>(env->NewStringUTF(profileName.c_str()));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeGetSemanticContext(
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeGetSemanticContext(
|
||||
JNIEnv* env,
|
||||
jclass /* this */) {
|
||||
return reinterpret_cast<jlong>(LogManager::GetSemanticContext());
|
||||
}
|
||||
jclass /* this */)
|
||||
{
|
||||
return reinterpret_cast<jlong>(WrapperLogManager::GetSemanticContext());
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextStringValue(
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextStringValue(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jstring jstrName,
|
||||
jstring jstrValue,
|
||||
jint piiKind) {
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
auto value = JStringToStdString(env, jstrValue);
|
||||
return static_cast<jint>(LogManager::SetContext(name, value, static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
jint piiKind)
|
||||
{
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
auto value = JStringToStdString(env, jstrValue);
|
||||
return static_cast<jint>(WrapperLogManager::SetContext(name, value, static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextIntValue(
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextIntValue(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jstring jstrName,
|
||||
jint jValue,
|
||||
jint piiKind) {
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
return static_cast<jint>(LogManager::SetContext(name, static_cast<int32_t>(jValue), static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
jint piiKind)
|
||||
{
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
return static_cast<jint>(WrapperLogManager::SetContext(name, static_cast<int32_t>(jValue), static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextLongValue(
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextLongValue(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jstring jstrName,
|
||||
jlong jValue,
|
||||
jint piiKind) {
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
return static_cast<jint>(LogManager::SetContext(name, static_cast<int64_t>(jValue), static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
jint piiKind)
|
||||
{
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
return static_cast<jint>(WrapperLogManager::SetContext(name, static_cast<int64_t>(jValue), static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextDoubleValue(
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextDoubleValue(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jstring jstrName,
|
||||
jdouble jValue,
|
||||
jint piiKind) {
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
return static_cast<jint>(LogManager::SetContext(name, static_cast<double>(jValue), static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
jint piiKind)
|
||||
{
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
return static_cast<jint>(WrapperLogManager::SetContext(name, static_cast<double>(jValue), static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextBoolValue(
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextBoolValue(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jstring jstrName,
|
||||
jboolean jValue,
|
||||
jint piiKind) {
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
return static_cast<jint>(LogManager::SetContext(name, static_cast<bool>(jValue), static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
jint piiKind)
|
||||
{
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
return static_cast<jint>(WrapperLogManager::SetContext(name, static_cast<bool>(jValue), static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextTimeTicksValue(
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextTimeTicksValue(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jstring jstrName,
|
||||
jlong jValue,
|
||||
jint piiKind) {
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
return static_cast<jint>(LogManager::SetContext(name, time_ticks_t(static_cast<uint64_t>(jValue)), static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
jint piiKind)
|
||||
{
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
return static_cast<jint>(WrapperLogManager::SetContext(name, time_ticks_t(static_cast<uint64_t>(jValue)), static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextGuidValue(
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeSetContextGuidValue(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jstring jstrName,
|
||||
jstring jstrValue,
|
||||
jint piiKind) {
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
auto value = JStringToStdString(env, jstrValue);
|
||||
return static_cast<jint>(LogManager::SetContext(name, GUID_t(value.c_str()), static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
jint piiKind)
|
||||
{
|
||||
auto name = JStringToStdString(env, jstrName);
|
||||
auto value = JStringToStdString(env, jstrValue);
|
||||
return static_cast<jint>(WrapperLogManager::SetContext(name, GUID_t(value.c_str()), static_cast<PiiKind>(piiKind)));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeGetLogger(
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeGetLogger(
|
||||
JNIEnv* /* env */,
|
||||
jclass /* this */) {
|
||||
ILogger* logger = LogManager::GetLogger();
|
||||
return reinterpret_cast<jlong>(logger);
|
||||
}
|
||||
jclass /* this */)
|
||||
{
|
||||
ILogger* logger = WrapperLogManager::GetLogger();
|
||||
return reinterpret_cast<jlong>(logger);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeGetLoggerWithSource(
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeGetLoggerWithSource(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jstring jstrSource) {
|
||||
auto source = JStringToStdString(env, jstrSource);
|
||||
ILogger* logger = LogManager::GetLogger(source);
|
||||
return reinterpret_cast<jlong>(logger);
|
||||
}
|
||||
jstring jstrSource)
|
||||
{
|
||||
auto source = JStringToStdString(env, jstrSource);
|
||||
ILogger* logger = WrapperLogManager::GetLogger(source);
|
||||
return reinterpret_cast<jlong>(logger);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeGetLoggerWithTenantTokenAndSource(
|
||||
JNIEXPORT jlong JNICALL Java_com_microsoft_applications_events_LogManager_nativeGetLoggerWithTenantTokenAndSource(
|
||||
JNIEnv* env,
|
||||
jclass /* this */,
|
||||
jstring jstrTenantToken,
|
||||
jstring jstrSource){
|
||||
auto tenantToken = JStringToStdString(env, jstrTenantToken);
|
||||
auto source = JStringToStdString(env, jstrSource);
|
||||
ILogger* logger = LogManager::GetLogger(tenantToken, source);
|
||||
return reinterpret_cast<jlong>(logger);
|
||||
jstring jstrSource)
|
||||
{
|
||||
auto tenantToken = JStringToStdString(env, jstrTenantToken);
|
||||
auto source = JStringToStdString(env, jstrSource);
|
||||
ILogger* logger = WrapperLogManager::GetLogger(tenantToken, source);
|
||||
return reinterpret_cast<jlong>(logger);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -558,4 +558,4 @@ JNIEXPORT void JNICALL Java_com_microsoft_applications_events_Logger_nativeSetLe
|
|||
logger->SetLevel(static_cast<int>(jLevel));
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef WRAPPERLOGMANAGER_HPP
|
||||
#define WRAPPERLOGMANAGER_HPP
|
||||
#include "LogManagerBase.hpp"
|
||||
|
||||
namespace ARIASDK_NS_BEGIN {
|
||||
class WrapperConfig: public ILogConfiguration {
|
||||
};
|
||||
class WrapperLogManager: public LogManagerBase<WrapperConfig> {
|
||||
};
|
||||
} ARIASDK_NS_END
|
||||
#endif
|
||||
|
Загрузка…
Ссылка в новой задаче