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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
2016-10-22 09:51:17 -07:00
|
|
|
|
using System.Runtime.InteropServices;
|
2016-10-19 11:01:24 -07:00
|
|
|
|
|
|
|
|
|
namespace Facebook.CSSLayout
|
|
|
|
|
{
|
|
|
|
|
internal static class CSSLogger
|
|
|
|
|
{
|
2016-10-22 09:51:17 -07:00
|
|
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
2016-11-09 10:14:22 -08:00
|
|
|
|
public delegate void Func(CSSLogLevel level, string message);
|
2016-10-19 11:01:24 -07:00
|
|
|
|
|
|
|
|
|
private static bool _initialized;
|
|
|
|
|
private static Func _managedLogger = null;
|
|
|
|
|
|
|
|
|
|
public static Func Logger = null;
|
|
|
|
|
|
|
|
|
|
public static void Initialize()
|
|
|
|
|
{
|
|
|
|
|
if (!_initialized)
|
|
|
|
|
{
|
2016-11-09 10:14:22 -08:00
|
|
|
|
_managedLogger = (level, message) => {
|
2016-10-19 11:01:24 -07:00
|
|
|
|
if (Logger != null)
|
|
|
|
|
{
|
2016-11-09 10:14:22 -08:00
|
|
|
|
Logger(level, message);
|
2016-10-19 11:01:24 -07:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
Native.CSSInteropSetLogger(_managedLogger);
|
|
|
|
|
_initialized = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|