2016-10-19 11:01:24 -07:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "CSSInterop.h"
|
|
|
|
|
|
|
|
static CSSInteropLoggerFunc gManagedFunc;
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
static int unmanagedLogger(YGLogLevel level, const char *format, va_list args) {
|
2016-10-19 11:01:24 -07:00
|
|
|
int result = 0;
|
|
|
|
if (gManagedFunc) {
|
|
|
|
char buffer[256];
|
|
|
|
result = vsnprintf(buffer, sizeof(buffer), format, args);
|
2016-11-09 10:14:22 -08:00
|
|
|
(*gManagedFunc)(level, buffer);
|
2016-10-19 11:01:24 -07:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSSInteropSetLogger(CSSInteropLoggerFunc managedFunc) {
|
|
|
|
gManagedFunc = managedFunc;
|
|
|
|
CSSLayoutSetLogger(&unmanagedLogger);
|
|
|
|
}
|