Add support for context-aware logging functions
Summary: @public Context-aware logging functions are an internal Yoga feature that will be used for Yoga’s JNI code. It will be possible to specify a context when calculating layout, which will be passed on to baseline and measure functions. This will be a private feature. Reviewed By: SidharthGuglani Differential Revision: D14123482 fbshipit-source-id: 8ba3b6c493bf79fe09831f22d2b6da44f09e3d95
This commit is contained in:
committed by
Facebook Github Bot
parent
0bdf36f5d1
commit
d5ad51bccc
14
yoga/log.cpp
14
yoga/log.cpp
@@ -21,10 +21,11 @@ void vlog(
|
||||
YGConfig* config,
|
||||
YGNode* node,
|
||||
YGLogLevel level,
|
||||
void* context,
|
||||
const char* format,
|
||||
va_list args) {
|
||||
YGConfig* logConfig = config != nullptr ? config : YGConfigGetDefault();
|
||||
logConfig->log(logConfig, node, level, format, args);
|
||||
logConfig->log(logConfig, node, level, context, format, args);
|
||||
|
||||
if (level == YGLogLevelFatal) {
|
||||
abort();
|
||||
@@ -35,23 +36,30 @@ void vlog(
|
||||
void Log::log(
|
||||
YGNode* node,
|
||||
YGLogLevel level,
|
||||
void* context,
|
||||
const char* format,
|
||||
...) noexcept {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vlog(
|
||||
node == nullptr ? nullptr : node->getConfig(), node, level, format, args);
|
||||
node == nullptr ? nullptr : node->getConfig(),
|
||||
node,
|
||||
level,
|
||||
context,
|
||||
format,
|
||||
args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void Log::log(
|
||||
YGConfig* config,
|
||||
YGLogLevel level,
|
||||
void* context,
|
||||
const char* format,
|
||||
...) noexcept {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vlog(config, nullptr, level, format, args);
|
||||
vlog(config, nullptr, level, context, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user