mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
Merge branch 'dev-es' of https://github.com/MobileGL-Dev/MobileGL into dev-es
This commit is contained in:
+12
-5
@@ -31,11 +31,18 @@ namespace ankerl {
|
|||||||
|
|
||||||
namespace MG_Constants {
|
namespace MG_Constants {
|
||||||
namespace Common {
|
namespace Common {
|
||||||
inline const int LOG_LEVEL_DEBUG = 0x0010;
|
inline constexpr int LOG_LEVEL_DEBUG = 0x0010;
|
||||||
inline const int LOG_LEVEL_WARN = 0x0011;
|
inline constexpr int LOG_LEVEL_WARN = 0x0011;
|
||||||
inline const int LOG_LEVEL_ERROR = 0x0012;
|
inline constexpr int LOG_LEVEL_ERROR = 0x0012;
|
||||||
inline const int LOG_LEVEL_INFO = 0x0013;
|
inline constexpr int LOG_LEVEL_INFO = 0x0013;
|
||||||
inline const int LOG_LEVEL_FATAL = 0x0014;
|
inline constexpr int LOG_LEVEL_FATAL = 0x0014;
|
||||||
|
|
||||||
|
|
||||||
|
inline constexpr int LOG_TARGET_NONE = 0x00;
|
||||||
|
inline constexpr int LOG_TARGET_CONSOLE = 0x01;
|
||||||
|
inline constexpr int LOG_TARGET_FILE = 0x02;
|
||||||
|
inline constexpr int LOG_TARGET_ANDROID = 0x04; // Android logcat
|
||||||
|
inline constexpr int LOG_TARGET_ALL = LOG_TARGET_CONSOLE | LOG_TARGET_FILE | LOG_TARGET_ANDROID;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Blend {
|
namespace Blend {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace MG_Global {
|
|||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
inline constexpr int LogLevel = MG_Constants::Common::LOG_LEVEL_INFO;
|
inline constexpr int LogLevel = MG_Constants::Common::LOG_LEVEL_INFO;
|
||||||
|
inline constexpr int LogTarget = MG_Constants::Common::LOG_TARGET_ALL;
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
inline const char* LOG_FILE_PATH = "/sdcard/MG/latest.log";
|
inline const char* LOG_FILE_PATH = "/sdcard/MG/latest.log";
|
||||||
|
|||||||
@@ -71,15 +71,23 @@ namespace MG_Util::Debug {
|
|||||||
std::string full_format = header + format + "\n";
|
std::string full_format = header + format + "\n";
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
|
if (MG_Global::Common::LogTarget & MG_Constants::Common::LOG_TARGET_ANDROID) {
|
||||||
__android_log_vprint(androidLevel, MG_Constants::RenderName, full_format.c_str(), args);
|
__android_log_vprint(androidLevel, MG_Constants::RenderName, full_format.c_str(), args);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (MG_Global::Common::LogTarget & MG_Constants::Common::LOG_TARGET_CONSOLE) {
|
||||||
vprintf(full_format.c_str(), args);
|
vprintf(full_format.c_str(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((MG_Global::Common::LogTarget & MG_Constants::Common::LOG_TARGET_FILE) &&
|
||||||
|
MG_Global::Common::LOG_FILE_PATH != nullptr) {
|
||||||
va_list args_copy;
|
va_list args_copy;
|
||||||
va_copy(args_copy, args);
|
va_copy(args_copy, args);
|
||||||
LogWrite(full_format.c_str(), args_copy);
|
LogWrite(full_format.c_str(), args_copy);
|
||||||
va_end(args_copy);
|
va_end(args_copy);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define DECLARE_LOG_FUNCTION(name, level) \
|
#define DECLARE_LOG_FUNCTION(name, level) \
|
||||||
void Log##name(const char* format, ...) { \
|
void Log##name(const char* format, ...) { \
|
||||||
|
|||||||
Reference in New Issue
Block a user