Create core/ directory with platform-agnostic sandbox components: - Timer manager, JSON API, Crypto API, Virtual FS - Lua sandbox, Permission gate, Audit log, Rate limiter - Platform abstraction interfaces (IAssetInterface, IFilesystemInterface) - Platform-agnostic logger with Android/Desktop implementations Update designer to link against mosis-core library instead of including sandbox sources directly. This is the foundation for unifying the Android service and desktop designer to share the same codebase. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
#pragma once
|
|
#include <string>
|
|
#include <cstdio>
|
|
#include <cstdarg>
|
|
|
|
class Logger
|
|
{
|
|
public:
|
|
static void Log(const std::string& message);
|
|
|
|
// Printf-style logging
|
|
static void LogF(const char* level, const char* fmt, ...) {
|
|
char buffer[1024];
|
|
va_list args;
|
|
va_start(args, fmt);
|
|
vsnprintf(buffer, sizeof(buffer), fmt, args);
|
|
va_end(args);
|
|
Log(std::string("[") + level + "] " + buffer);
|
|
}
|
|
};
|
|
|
|
// Undefine conflicting syslog macros if present
|
|
#ifdef LOG_DEBUG
|
|
#undef LOG_DEBUG
|
|
#endif
|
|
#ifdef LOG_INFO
|
|
#undef LOG_INFO
|
|
#endif
|
|
#ifdef LOG_WARN
|
|
#undef LOG_WARN
|
|
#endif
|
|
#ifdef LOG_ERROR
|
|
#undef LOG_ERROR
|
|
#endif
|
|
|
|
// Logging macros for convenience (printf-style)
|
|
#define LOG_DEBUG(fmt, ...) Logger::LogF("DEBUG", fmt __VA_OPT__(,) __VA_ARGS__)
|
|
#define LOG_INFO(fmt, ...) Logger::LogF("INFO", fmt __VA_OPT__(,) __VA_ARGS__)
|
|
#define LOG_WARN(fmt, ...) Logger::LogF("WARN", fmt __VA_OPT__(,) __VA_ARGS__)
|
|
#define LOG_ERROR(fmt, ...) Logger::LogF("ERROR", fmt __VA_OPT__(,) __VA_ARGS__)
|