Skip to content

Commit aa36401

Browse files
committed
feat(ios): expand native fragment handling
1 parent 21c89ed commit aa36401

24 files changed

Lines changed: 1129 additions & 475 deletions

cpp/NitroTextLogger.hpp

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
//
2+
// NitroTextLogger.hpp
3+
//
4+
//
5+
6+
#pragma once
7+
8+
#include <string>
9+
#include <sstream>
10+
#include <iostream>
11+
12+
// Check if we're in debug mode
13+
#ifndef NDEBUG
14+
#define NITRO_TEXT_DEBUG_LOGGING 1
15+
#else
16+
#define NITRO_TEXT_DEBUG_LOGGING 0
17+
#endif
18+
19+
namespace margelo::nitro::nitrotext::logger {
20+
21+
/**
22+
* @brief Logs an informational message
23+
* @param message The message to log
24+
* @param tag Optional tag identifier for categorization
25+
*
26+
* Only logs in debug builds to avoid performance overhead in production
27+
*/
28+
inline void info(
29+
const std::string& message,
30+
const std::string& tag = "") {
31+
#if NITRO_TEXT_DEBUG_LOGGING
32+
std::ostringstream oss;
33+
oss << "[NitroText]";
34+
if (!tag.empty()) {
35+
oss << " [" << tag << "]";
36+
}
37+
oss << " " << message;
38+
std::cout << oss.str() << std::endl;
39+
#else
40+
// No-op in release builds
41+
(void)message;
42+
(void)tag;
43+
#endif
44+
}
45+
46+
/**
47+
* @brief Logs a warning message
48+
* @param message The warning message to log
49+
* @param tag Optional tag identifier for categorization
50+
*
51+
* Only logs in debug builds to avoid performance overhead in production
52+
*/
53+
inline void warn(
54+
const std::string& message,
55+
const std::string& tag = "") {
56+
#if NITRO_TEXT_DEBUG_LOGGING
57+
std::ostringstream oss;
58+
oss << "[NitroText] [WARN]";
59+
if (!tag.empty()) {
60+
oss << " [" << tag << "]";
61+
}
62+
oss << " " << message;
63+
std::cerr << oss.str() << std::endl;
64+
#else
65+
// No-op in release builds
66+
(void)message;
67+
(void)tag;
68+
#endif
69+
}
70+
71+
/**
72+
* @brief Logs an error message
73+
* @param message The error message to log
74+
* @param tag Optional tag identifier for categorization
75+
*
76+
* Only logs in debug builds to avoid performance overhead in production
77+
*/
78+
inline void error(
79+
const std::string& message,
80+
const std::string& tag = "") {
81+
#if NITRO_TEXT_DEBUG_LOGGING
82+
std::ostringstream oss;
83+
oss << "[NitroText] [ERROR]";
84+
if (!tag.empty()) {
85+
oss << " [" << tag << "]";
86+
}
87+
oss << " " << message;
88+
std::cerr << oss.str() << std::endl;
89+
#else
90+
// No-op in release builds
91+
(void)message;
92+
(void)tag;
93+
#endif
94+
}
95+
96+
} // namespace margelo::nitro::nitrotext::logger

0 commit comments

Comments
 (0)