2019-06-06 19:36:56 -07:00
|
|
|
/*
|
2019-02-19 09:54:45 -08:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
|
|
*
|
2019-10-15 10:30:08 -07:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2019-02-19 09:54:45 -08:00
|
|
|
*/
|
2019-10-15 10:30:08 -07:00
|
|
|
|
2019-02-19 09:54:45 -08:00
|
|
|
#include "log.h"
|
|
|
|
|
|
|
|
#include "Yoga.h"
|
|
|
|
#include "YGConfig.h"
|
|
|
|
#include "YGNode.h"
|
|
|
|
|
|
|
|
namespace facebook {
|
|
|
|
namespace yoga {
|
|
|
|
namespace detail {
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
void vlog(
|
|
|
|
YGConfig* config,
|
|
|
|
YGNode* node,
|
|
|
|
YGLogLevel level,
|
2019-02-19 09:54:45 -08:00
|
|
|
void* context,
|
2019-02-19 09:54:45 -08:00
|
|
|
const char* format,
|
|
|
|
va_list args) {
|
|
|
|
YGConfig* logConfig = config != nullptr ? config : YGConfigGetDefault();
|
2019-02-19 09:54:45 -08:00
|
|
|
logConfig->log(logConfig, node, level, context, format, args);
|
2019-02-19 09:54:45 -08:00
|
|
|
}
|
|
|
|
} // namespace
|
|
|
|
|
2019-11-01 11:45:19 -07:00
|
|
|
YOGA_EXPORT void Log::log(
|
2019-02-19 09:54:45 -08:00
|
|
|
YGNode* node,
|
|
|
|
YGLogLevel level,
|
2019-02-19 09:54:45 -08:00
|
|
|
void* context,
|
2019-02-19 09:54:45 -08:00
|
|
|
const char* format,
|
|
|
|
...) noexcept {
|
|
|
|
va_list args;
|
|
|
|
va_start(args, format);
|
|
|
|
vlog(
|
2019-02-19 09:54:45 -08:00
|
|
|
node == nullptr ? nullptr : node->getConfig(),
|
|
|
|
node,
|
|
|
|
level,
|
|
|
|
context,
|
|
|
|
format,
|
|
|
|
args);
|
2019-02-19 09:54:45 -08:00
|
|
|
va_end(args);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Log::log(
|
|
|
|
YGConfig* config,
|
|
|
|
YGLogLevel level,
|
2019-02-19 09:54:45 -08:00
|
|
|
void* context,
|
2019-02-19 09:54:45 -08:00
|
|
|
const char* format,
|
|
|
|
...) noexcept {
|
|
|
|
va_list args;
|
|
|
|
va_start(args, format);
|
2019-02-19 09:54:45 -08:00
|
|
|
vlog(config, nullptr, level, context, format, args);
|
2019-02-19 09:54:45 -08:00
|
|
|
va_end(args);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace detail
|
|
|
|
} // namespace yoga
|
|
|
|
} // namespace facebook
|