Files
yoga/csharp/Facebook.CSSLayout/CSSAssert.cs
Kazuki Sakamoto daed6f5b8a Introduce CSSLayoutSetLogger to pass the print result to C# side
Summary:
- CSSLayoutSetLogger
  - Problem: Unity or other logging system can't use printf output
  - Solution: Add CSSLogger to pass CSSNodePrint result to UnityEngine.Debug.Log or other logging system via CSSLogger function for debugging purpose

Reviewed By: emilsjolander

Differential Revision: D4027044

fbshipit-source-id: 90e2e449260888770f71fa7ea790ca9764d91c44
2016-10-19 11:08:08 -07:00

34 lines
909 B
C#

/**
* 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.
*/
using System;
namespace Facebook.CSSLayout
{
internal static class CSSAssert
{
public delegate void FailFunc(string message);
private static bool _assertInitialized;
private static FailFunc _failFunc;
public static void Initialize()
{
if (!_assertInitialized)
{
_failFunc = (message) => {
throw new InvalidOperationException(message);
};
Native.CSSAssertSetFailFunc(_failFunc);
_assertInitialized = true;
}
}
}
}