2022-02-05 18:06:25 -08:00

56 lines
2.4 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
// This file is automatically generated. Changes to this file may be overwritten.
namespace Epic.OnlineServices.Logging
{
public static class LoggingInterface
{
/// <summary>
/// Set the callback function to use for SDK log messages. Any previously set callback will no longer be called.
/// <seealso cref="Platform.PlatformInterface.Initialize" />
/// </summary>
/// <param name="callback">the function to call when the SDK logs messages</param>
/// <returns>
/// <see cref="Result.Success" /> is returned if the callback will be used for future log messages.
/// <see cref="Result.NotConfigured" /> is returned if the SDK has not yet been initialized, or if it has been shut down
/// </returns>
public static Result SetCallback(LogMessageFunc callback)
{
var callbackInternal = new LogMessageFuncInternal(LogMessageFuncInternalImplementation);
Helper.AddStaticCallback("LogMessageFuncInternalImplementation", callback, callbackInternal);
var funcResult = Bindings.EOS_Logging_SetCallback(callbackInternal);
return funcResult;
}
/// <summary>
/// Set the logging level for the specified logging category. By default all log categories will callback for Warnings, Errors, and Fatals.
/// </summary>
/// <param name="logCategory">the specific log category to configure. Use <see cref="LogCategory.AllCategories" /> to configure all categories simultaneously to the same log level.</param>
/// <param name="logLevel">the log level to use for the log category</param>
/// <returns>
/// <see cref="Result.Success" /> is returned if the log levels are now in use.
/// <see cref="Result.NotConfigured" /> is returned if the SDK has not yet been initialized, or if it has been shut down.
/// </returns>
public static Result SetLogLevel(LogCategory logCategory, LogLevel logLevel)
{
var funcResult = Bindings.EOS_Logging_SetLogLevel(logCategory, logLevel);
return funcResult;
}
[MonoPInvokeCallback(typeof(LogMessageFuncInternal))]
internal static void LogMessageFuncInternalImplementation(System.IntPtr message)
{
LogMessageFunc callback;
if (Helper.TryGetStaticCallback("LogMessageFuncInternalImplementation", out callback))
{
LogMessage messageObj;
Helper.TryMarshalGet<LogMessageInternal, LogMessage>(message, out messageObj);
callback(messageObj);
}
}
}
}