Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make on TextLogLevel PascalCase (instead of SCREAMING CASE) to avoid clashes with preprocessor defines #4152

Merged
merged 6 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/code-examples/text_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ int main() {
const auto rec = rerun::RecordingStream("rerun_example_text_log");
rec.spawn().exit_on_failure();

rec.log("log", rerun::TextLog("Application started.").with_level(rerun::TextLogLevel::INFO));
rec.log(
"log",
rerun::TextLog("Application started.").with_level(rerun::TextLogLevel::LEVEL_INFO)
);
}
14 changes: 7 additions & 7 deletions docs/code-examples/text_log_integration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ void loguru_to_rerun(void* user_data, const loguru::Message& message) {

rerun::TextLogLevel level;
if (message.verbosity == loguru::Verbosity_FATAL) {
level = rerun::TextLogLevel::CRITICAL;
level = rerun::TextLogLevel::LEVEL_CRITICAL;
} else if (message.verbosity == loguru::Verbosity_ERROR) {
level = rerun::TextLogLevel::ERROR;
level = rerun::TextLogLevel::LEVEL_ERROR;
} else if (message.verbosity == loguru::Verbosity_WARNING) {
level = rerun::TextLogLevel::WARN;
level = rerun::TextLogLevel::LEVEL_WARN;
} else if (message.verbosity == loguru::Verbosity_INFO) {
level = rerun::TextLogLevel::INFO;
level = rerun::TextLogLevel::LEVEL_INFO;
} else if (message.verbosity == loguru::Verbosity_1) {
level = rerun::TextLogLevel::DEBUG;
level = rerun::TextLogLevel::LEVEL_DEBUG;
} else if (message.verbosity == loguru::Verbosity_2) {
level = rerun::TextLogLevel::TRACE;
level = rerun::TextLogLevel::LEVEL_TRACE;
} else {
level = rerun::TextLogLevel(std::to_string(message.verbosity));
}
Expand All @@ -38,7 +38,7 @@ int main() {
// Log a text entry directly:
rec.log(
"logs",
rerun::TextLog("this entry has loglevel TRACE").with_level(rerun::TextLogLevel::TRACE)
rerun::TextLog("this entry has loglevel TRACE").with_level(rerun::TextLogLevel::LEVEL_TRACE)
);

loguru::add_callback(
Expand Down
14 changes: 7 additions & 7 deletions rerun_cpp/src/rerun/archetypes/text_log.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions rerun_cpp/src/rerun/components/text_log_level.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions rerun_cpp/src/rerun/components/text_log_level_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ namespace rerun {
// [CODEGEN COPY TO HEADER START]

/// Designates catastrophic failures.
static const TextLogLevel CRITICAL;
static const TextLogLevel LEVEL_CRITICAL;

/// Designates very serious errors.
static const TextLogLevel ERROR;
static const TextLogLevel LEVEL_ERROR;

/// Designates hazardous situations.
static const TextLogLevel WARN;
static const TextLogLevel LEVEL_WARN;

/// Designates useful information.
static const TextLogLevel INFO;
static const TextLogLevel LEVEL_INFO;

/// Designates lower priority information.
static const TextLogLevel DEBUG;
static const TextLogLevel LEVEL_DEBUG;

/// Designates very low priority, often extremely verbose, information.
static const TextLogLevel TRACE;
static const TextLogLevel LEVEL_TRACE;

/// Construct `TextLogLevel` from a null-terminated UTF8 string.
TextLogLevel(const char* str) : value(str) {}
Expand All @@ -48,11 +48,11 @@ namespace rerun {
#define TextLogLevelExt TextLogLevel
#endif

const TextLogLevel TextLogLevel::CRITICAL = "CRITICAL";
const TextLogLevel TextLogLevel::ERROR = "ERROR";
const TextLogLevel TextLogLevel::WARN = "WARN";
const TextLogLevel TextLogLevel::INFO = "INFO";
const TextLogLevel TextLogLevel::DEBUG = "DEBUG";
const TextLogLevel TextLogLevel::TRACE = "TRACE";
const TextLogLevel TextLogLevel::LEVEL_CRITICAL = "CRITICAL";
const TextLogLevel TextLogLevel::LEVEL_ERROR = "ERROR";
const TextLogLevel TextLogLevel::LEVEL_WARN = "WARN";
const TextLogLevel TextLogLevel::LEVEL_INFO = "INFO";
const TextLogLevel TextLogLevel::LEVEL_DEBUG = "DEBUG";
const TextLogLevel TextLogLevel::LEVEL_TRACE = "TRACE";
} // namespace components
} // namespace rerun
Loading