using System; using System.Collections.Generic; using System.Diagnostics; using Ubisoft.Hotel.Logger; using Ubisoft.Hotel.Package; namespace Ubisoft { /// /// HtLogger is used instead of simply Logger to avoid name collisions with UnityEngine.Logger when used with using clausules /// public partial class HtLogger { private static HtLogger s_instance; public static HtLogger Instance { get { if (s_instance == null) { s_instance = new HtLogger(); } return s_instance; } } public static string GetLoggerDefineSymbol(ELogLevel logLevel) { return $"HT_LOGGER_{logLevel.ToString().ToUpper()}_ON"; } public const string HT_LOGGER_ASSERT_ON = "UNITY_ASSERTIONS"; public const string HT_LOGGER_TRACE_ON = "HT_LOGGER_TRACE_ON"; public const string HT_LOGGER_DEBUG_ON = "HT_LOGGER_DEBUG_ON"; public const string HT_LOGGER_INFORMATION_ON = "HT_LOGGER_INFORMATION_ON"; public const string HT_LOGGER_WARNING_ON = "HT_LOGGER_WARNING_ON"; public const string HT_LOGGER_ERROR_ON = "HT_LOGGER_ERROR_ON"; public const string HT_LOGGER_CRITICAL_ON = "HT_LOGGER_CRITICAL_ON"; public const string HT_LOGGER_EXCEPTION_ON = "HT_LOGGER_EXCEPTION_ON"; private const string CHANNEL_COLOR = "#4E85E1"; [Serializable] public enum ELogLevel { Trace, Debug, Information, Warning, Error, Critical, None, } internal const string CHANNEL_GENERAL_NAME = "General"; private HtLogger_Imp m_imp; #pragma warning disable IDE0052 // Used only when HT_PACKAGE_PACKAGEMANAGER_PROD is defined private PlayerLoggerProperty m_property; #pragma warning restore IDE0052 // public List Channels { get; set; } private Channel m_helperChannel; private HashSet m_excludedChannels; private HashSet m_includedChannels; private HtLogger() { GeneralChannel = CreateChannel(CHANNEL_GENERAL_NAME); GeneralChannel.IsTagEnabled = false; } private void Init() { PlayerLoggerProperty loggerProperty = null; PlayerPackageSuite packageSuite = PlayerPackageSuite.Load(); if (packageSuite != null) { loggerProperty = packageSuite.GetProperty() as PlayerLoggerProperty; } Init(loggerProperty); } protected void Init(PlayerLoggerProperty property) { if (!IsInitialized) { m_property = property; IsInitialized = true; } Imp.Init(property); if (property != null && property.ChannelsPreset != null) { ApplyChannelsPreset(property.ChannelsPreset); } } public void ApplyChannelsPreset(ChannelsPreset value) { if (value != null) { if (value.OtherChannels) { EnableAllChannelsExcept(value.GetDisabledChannels()); } else { DisableAllChannelsExcept(value.GetEnabledChannels()); } } } private HtLogger_Imp Imp { get { if (m_imp == null) { #if HT_PACKAGE_ZLOGGER_PROD m_imp = new HtLogger_ImpZLogger(); #else m_imp = new HtLogger_ImpUnity(); #endif } return m_imp; } } private bool IsInitialized { get; set; } /// /// Return whether or not logging is enabled. This is a read-only information which is read from settings. /// If you need to disable logging just call DisableAllChannels(). /// public bool IsEnabled { get { // Make sure logging is enabled in editor mode. #if UNITY_EDITOR if (m_property == null && !UnityEngine.Application.isPlaying) { return true; } #endif // The property is defined via PackageManager. PackageManager is usually disabled when contributing to a package for convenience reasons #if HT_PACKAGE_PACKAGEMANAGER_PROD return m_property != null && m_property.MinLogLevel != ELogLevel.None; #else return true; #endif } } public interface IListener { void BeginLog(Channel channel, object message, ELogLevel logLevel, UnityEngine.Object context = null); void EndLog(); } private List m_listeners; public void AddListener(IListener listener) { if (m_listeners == null) { m_listeners = new List(); } m_listeners.Add(listener); } public void RemoveListener(IListener listener) { if (m_listeners != null && m_listeners.Contains(listener)) { _ = m_listeners.Remove(listener); } } /// /// Create a channel. Channels help you keep your logs organized. You are not allowed to instantiate directly a channel, instead, you need to use this method, /// so Logger can track all channels created around. /// /// Name of the channel /// Color for the messages logged to log levels ((Trace, Debug and Information)) that don't have their own color /// The channel object public Channel CreateChannel(string name, string color = null) { Channel returnValue = new Channel(this, name, color); RegisterChannel(returnValue); return returnValue; } /// /// Create a channel using Hotel conventions for text format and color. This method is reserved to and should be used by all Hotel packages that want to log messages. /// /// Name of the channel /// The channel object public Channel CreateHotelChannel(string name) { return CreateChannel($"[HT_{name}]", CHANNEL_COLOR); } private void RegisterChannel(Channel channel) { if (channel != null) { if (Channels == null) { Channels = new List(); } Channels.Add(channel); } } /// /// Default channel to use with no channel is specified. /// public Channel GeneralChannel { get; } private Channel GetHelperChannel(string name) { if (m_helperChannel == null) { m_helperChannel = new Channel(this, name); } else { m_helperChannel.Name = name; } return m_helperChannel; } /// /// Enable all channels. By default all channels are enabled. Use this method after having used DisableAllChannels() /// when you want to go back to the default status. /// public void EnableAllChannels() { m_includedChannels = null; m_excludedChannels = null; } /// /// Disable all channels. /// public void DisableAllChannels() { m_includedChannels = new HashSet(); m_excludedChannels = null; } /// /// Enable all channels except the ones which names are passed in. Disabling channels may be useful when you want to reduce noise while debugging a given feature. /// /// Set of channel names to disable. public void EnableAllChannelsExcept(HashSet channelNames) { m_includedChannels = null; m_excludedChannels = new HashSet(); _ = m_excludedChannels.AddRange(channelNames); } /// /// Disable all channels except the ones which names are passed in. Disabling channels may be useful when you want to reduce noise while debugging a given feature. /// /// Set of channel names to enable. public void DisableAllChannelsExcept(HashSet channelNames) { m_excludedChannels = null; m_includedChannels = new HashSet(); _ = m_includedChannels.AddRange(channelNames); } /// /// Enable all channels except the ones which names are passed in. Disabling channels may be useful when you want to reduce noise while debugging a given feature. /// /// Set of channels to disable. public void EnableAllChannelsExcept(HashSet channels) { EnableAllChannelsExcept(GetChannelNames(channels)); } /// /// Disable all channels except the ones which names are passed in. Disabling channels may be useful when you want to reduce noise while debugging a given feature. /// /// Set of channels to enable. public void DisableAllChannelsExcept(HashSet channels) { DisableAllChannelsExcept(GetChannelNames(channels)); } private static HashSet GetChannelNames(HashSet channels) { HashSet returnValue = new HashSet(); if (channels != null) { foreach (Channel channel in channels) { _ = returnValue.Add(channel.Name); } } return returnValue; } internal void InternalLog(Channel channel, object message, ELogLevel logLevel, UnityEngine.Object context = null) { if (channel == null) { channel = GeneralChannel; } if (CanLog(channel)) { // Notifies listeners before printing to Unity Logger so listeners can disable Unity Logger if // they're supposed to take over in order to avoid the same message to be logged twice if (m_listeners != null) { int count = m_listeners.Count; for (int i = 0; i < count; ++i) { m_listeners[i].BeginLog(channel, message, logLevel, context); } } Imp.Log(channel, message, logLevel, context); // Notifies listeners after printing to Unity Logger so listeners can enable Unity Logger again if (m_listeners != null) { int count = m_listeners.Count; for (int i = 0; i < count; ++i) { m_listeners[i].EndLog(); } } } } internal void InternalAssert(string channel, bool condition, object message, UnityEngine.Object context = null) { InternalAssert(GetHelperChannel(channel), condition, message, context); } internal void InternalAssert(Channel channel, bool condition, object message, UnityEngine.Object context) { if (channel == null) { channel = GeneralChannel; } if (CanLog(channel)) { Imp.Assert(channel, condition, message, context); } } internal void InternalLogAssertion(string channel, object message, UnityEngine.Object context) { InternalLogAssertion(GetHelperChannel(channel), message, context); } internal void InternalLogAssertion(Channel channel, object message, UnityEngine.Object context) { if (channel == null) { channel = GeneralChannel; } if (CanLog(channel)) { Imp.LogAssertion(channel, message, context); } } internal void InternalLogException(Channel channel, System.Exception exception, UnityEngine.Object context) { if (channel == null) { channel = GeneralChannel; } if (CanLog(channel)) { Imp.LogException(channel, exception, context); } } private bool CanLog(Channel channel) { bool returnValue = false; if (IsChannelEnabled(channel)) { if (!IsInitialized) { Init(); // If we're initialising then we need to verify that this channel is actually enabled returnValue = IsChannelEnabled(channel); } else { returnValue = true; } if (returnValue) { returnValue = IsEnabled; } } return returnValue; } public bool IsChannelEnabled(Channel channel) { bool returnValue = channel.IsEnabled; if (returnValue) { if (m_excludedChannels != null && m_excludedChannels.Contains(channel.Name)) { returnValue = false; } else if (m_includedChannels != null && !m_includedChannels.Contains(channel.Name)) { returnValue = false; } } return returnValue; } // // Asset // // /// Assert a condition and log a generic error message to all Logger streams on failure. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Condition you expect to be true. [Conditional(HT_LOGGER_ASSERT_ON)] public void Assert(bool condition) { InternalAssert(GeneralChannel, condition, null, null); } // // Log // /// /// Log a Trace message to all Logger streams. /// /// Trace logs contain the most detailed messages. These messages may contain sensitive application data. /// These messages are disabled by default and should never be enabled in a production environment. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Trace. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Message to log. [Conditional(HT_LOGGER_TRACE_ON)] public void LogTrace(object message) { InternalLog(GeneralChannel, message, ELogLevel.Trace); } /// /// Log a Debug message to all Logger streams. /// /// Debug logs are used for interactive investigation during development. These logs should primarily contain information useful /// for debugging and have no long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Debug or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Message to log. [Conditional(HT_LOGGER_DEBUG_ON)] public void LogDebug(object message) { InternalLog(GeneralChannel, message, ELogLevel.Trace); } /// /// Log an Information message to all Logger streams. /// /// Information logs track the general flow of the application (breadcrumbs). These logs should have long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Information or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Message to log. [Conditional(HT_LOGGER_INFORMATION_ON)] public void LogInformation(object message) { InternalLog(GeneralChannel, message, ELogLevel.Information); } /// /// Log a Warning message to all Logger streams. /// /// Warning logs highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Warning or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Message to log. [Conditional(HT_LOGGER_WARNING_ON)] public void LogWarning(object message) { InternalLog(GeneralChannel, message, ELogLevel.Warning); } /// /// Log an Error message to all Logger streams. /// /// Error logs highlight when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Error or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Message to log. [Conditional(HT_LOGGER_ERROR_ON)] public void LogError(object message) { InternalLog(GeneralChannel, message, ELogLevel.Error); } /// /// Log a Critical message to all Logger streams. /// /// Critical logs describe an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Critical or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Message to log. [Conditional(HT_LOGGER_CRITICAL_ON)] public void LogCritical(object message) { InternalLog(GeneralChannel, message, ELogLevel.Critical); } /// /// Assert a condition and log an error message to all Logger streams on failure. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Condition you expect to be true. /// Message to log. [Conditional(HT_LOGGER_ASSERT_ON)] public void Assert(bool condition, object message) { Assert(condition, message, null); } /// /// Log an assertion message to all Logger streams. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Message to log. [Conditional(HT_LOGGER_ASSERT_ON)] public void LogAssertion(object message) { InternalLogAssertion(GeneralChannel, message, null); } /// /// Log an exception to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Critical or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// /// Exception to log. [Conditional(HT_LOGGER_EXCEPTION_ON)] public void LogException(System.Exception exception) { InternalLogException(GeneralChannel, exception, null); } // // Log with context // /// /// Log a Trace message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Trace logs contain the most detailed messages. These messages may contain sensitive application data. /// These messages are disabled by default and should never be enabled in a production environment. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Trace. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_TRACE_ON)] public void LogTrace(object message, UnityEngine.Object context) { InternalLog(GeneralChannel, message, ELogLevel.Trace, context); } /// /// Log a Debug message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Debug logs are used for interactive investigation during development. These logs should primarily contain information useful /// for debugging and have no long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Debug or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_DEBUG_ON)] public void LogDebug(object message, UnityEngine.Object context) { InternalLog(GeneralChannel, message, ELogLevel.Debug, context); } /// /// Log an Information message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Information logs track the general flow of the application (breadcrumbs). These logs should have long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Information or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_INFORMATION_ON)] public void LogInformation(object message, UnityEngine.Object context) { InternalLog(GeneralChannel, message, ELogLevel.Information, context); } /// /// Log a Warning message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Warning logs highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Warning or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_WARNING_ON)] public void LogWarning(object message, UnityEngine.Object context) { InternalLog(GeneralChannel, message, ELogLevel.Warning, context); } /// /// Log an Error message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Error logs highlight when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Error or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_ERROR_ON)] public void LogError(object message, UnityEngine.Object context) { InternalLog(GeneralChannel, message, ELogLevel.Error, context); } /// /// Log a Critical message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Critical logs describe an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Critical or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_CRITICAL_ON)] public void LogCritical(object message, UnityEngine.Object context) { InternalLog(GeneralChannel, message, ELogLevel.Critical, context); } /// /// Assert a condition, log an error message to all Logger streams on failure and highlight in the hierarchy the object that the message applies to. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Condition you expect to be true. /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_ASSERT_ON)] public void Assert(bool condition, object message, UnityEngine.Object context) { InternalAssert(GeneralChannel, condition, message, context); } /// /// Log an assertion message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_ASSERT_ON)] public void LogAssertion(object message, UnityEngine.Object context) { InternalLogAssertion(GeneralChannel, message, context); } /// /// Log an exception to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Critical or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// /// Exception to log. /// Object to which the message applies. [Conditional(HT_LOGGER_EXCEPTION_ON)] public void LogException(System.Exception exception, UnityEngine.Object context) { InternalLogException(GeneralChannel, exception, context); } // // Log with format // /// /// Log a formated Trace message to all Logger streams. /// /// Trace logs contain the most detailed messages. These messages may contain sensitive application data. /// These messages are disabled by default and should never be enabled in a production environment. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Trace. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_TRACE_ON)] public void LogTraceFormat(string format, params object[] args) { InternalLog(GeneralChannel, string.Format(format, args), ELogLevel.Trace); } /// /// Log a formatted Debug message to all Logger streams. /// /// Debug logs are used for interactive investigation during development. These logs should primarily contain information useful /// for debugging and have no long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Debug or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_DEBUG_ON)] public void LogDebugFormat(string format, params object[] args) { InternalLog(GeneralChannel, string.Format(format, args), ELogLevel.Debug); } /// /// Log a formatted Information message to all Logger streams. /// /// Information logs track the general flow of the application (breadcrumbs). These logs should have long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Information or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_INFORMATION_ON)] public void LogInformationFormat(string format, params object[] args) { InternalLog(GeneralChannel, string.Format(format, args), ELogLevel.Information); } /// /// Log a formatted Warning message to all Logger streams. /// /// Warning logs highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Warning or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_WARNING_ON)] public void LogWarningFormat(string format, params object[] args) { InternalLog(GeneralChannel, string.Format(format, args), ELogLevel.Warning); } /// /// Log a formatted Error message to all Logger streams. /// /// Error logs highlight when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Error or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_ERROR_ON)] public void LogErrorFormat(string format, params object[] args) { InternalLog(GeneralChannel, string.Format(format, args), ELogLevel.Error); } /// /// Log a formatted Critical message to all Logger streams. /// /// Critical logs describe an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Critical or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_CRITICAL_ON)] public void LogCriticalFormat(string format, params object[] args) { InternalLog(GeneralChannel, string.Format(format, args), ELogLevel.Critical); } /// /// Assert a condition and log a formatted error message to all Logger streams on failure. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Condition you expect to be true. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_ASSERT_ON)] public void AssertFormat(bool condition, string format, params object[] args) { Assert(condition, string.Format(format, args)); } /// /// Log a formatted assertion message to all Logger streams. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_ASSERT_ON)] public void LogAssertionFormat(string format, params object[] args) { LogAssertion(string.Format(format, args)); } // // Log with context and format // /// /// Log a formated Trace message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Trace logs contain the most detailed messages. These messages may contain sensitive application data. /// These messages are disabled by default and should never be enabled in a production environment. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Trace. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_TRACE_ON)] public void LogTraceFormat(UnityEngine.Object context, string format, params object[] args) { InternalLog(GeneralChannel, string.Format(format, args), ELogLevel.Trace, context); } /// /// Log a formatted Debug message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Debug logs are used for interactive investigation during development. These logs should primarily contain information useful /// for debugging and have no long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Debug or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_DEBUG_ON)] public void LogDebugFormat(UnityEngine.Object context, string format, params object[] args) { InternalLog(GeneralChannel, string.Format(format, args), ELogLevel.Debug, context); } /// /// Log a formatted Information message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Information logs track the general flow of the application (breadcrumbs). These logs should have long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Information or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_INFORMATION_ON)] public void LogInformationFormat(UnityEngine.Object context, string format, params object[] args) { InternalLog(GeneralChannel, string.Format(format, args), ELogLevel.Information, context); } /// /// Log a formatted Warning message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Warning logs highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Warning or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_WARNING_ON)] public void LogWarningFormat(UnityEngine.Object context, string format, params object[] args) { InternalLog(GeneralChannel, string.Format(format, args), ELogLevel.Warning, context); } /// /// Log a formatted Error message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Error logs highlight when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Error or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_ERROR_ON)] public void LogErrorFormat(UnityEngine.Object context, string format, params object[] args) { InternalLog(GeneralChannel, string.Format(format, args), ELogLevel.Error, context); } /// /// Log a formatted Critical message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Critical logs describe an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Critical or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_CRITICAL_ON)] public void LogCriticalFormat(UnityEngine.Object context, string format, params object[] args) { InternalLog(GeneralChannel, string.Format(format, args), ELogLevel.Critical, context); } /// /// Assert a condition, log a formatted error message to all Logger streams on failure and highlight in the hierarchy the object that the message applies to. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Condition you expect to be true. /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_ASSERT_ON)] public void AssertFormat(bool condition, UnityEngine.Object context, string format, params object[] args) { Assert(condition, string.Format(format, args), context); } /// /// Log a formatted assertion message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_ASSERT_ON)] public void LogAssertionFormat(UnityEngine.Object context, string format, params object[] args) { LogAssertion(string.Format(format, args), context); } // // Log with channel // /// /// Log a Trace message to a channel for all Logger streams. /// /// Use Channel.LogTrace() instead if you need more control over the channel. /// /// Trace logs contain the most detailed messages. These messages may contain sensitive application data. /// These messages are disabled by default and should never be enabled in a production environment. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Trace. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. [Conditional(HT_LOGGER_TRACE_ON)] public void ChannelLogTrace(string channel, object message) { InternalLog(GetHelperChannel(channel), message, ELogLevel.Trace); } /// /// Log a Debug message to a channel for all Logger streams. /// /// Use Channel.LogDebug() instead if you need more control over the channel. /// /// Debug logs are used for interactive investigation during development. These logs should primarily contain information useful /// for debugging and have no long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Debug or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. [Conditional(HT_LOGGER_DEBUG_ON)] public void ChannelLogDebug(string channel, object message) { InternalLog(GetHelperChannel(channel), message, ELogLevel.Debug); } /// /// Log an Information message to a channel for all Logger streams. /// /// Use Channel.LogInformation() instead if you need more control over the channel. /// /// Information logs track the general flow of the application (breadcrumbs). These logs should have long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Information or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. [Conditional(HT_LOGGER_INFORMATION_ON)] public void ChannelLogInformation(string channel, object message) { InternalLog(GetHelperChannel(channel), message, ELogLevel.Information); } /// /// Log a Warning message to a channel for all Logger streams. /// /// Use Channel.LogWarning() instead if you need more control over the channel. /// /// Warning logs highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Warning or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. [Conditional(HT_LOGGER_WARNING_ON)] public void ChannelLogWarning(string channel, object message) { InternalLog(GetHelperChannel(channel), message, ELogLevel.Warning); } /// /// Log an Error message to a channel for all Logger streams. /// /// Use Channel.LogError() instead if you need more control over the channel. /// /// Error logs highlight when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Error or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. [Conditional(HT_LOGGER_ERROR_ON)] public void ChannelLogError(string channel, object message) { InternalLog(GetHelperChannel(channel), message, ELogLevel.Error); } /// /// Log a Critical message to a channel for all Logger streams. /// /// Use Channel.LogCritical() instead if you need more control over the channel. /// /// Critical logs describe an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Critical or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. [Conditional(HT_LOGGER_CRITICAL_ON)] public void ChannelLogCritical(string channel, object message) { InternalLog(GetHelperChannel(channel), message, ELogLevel.Critical); } /// /// Assert a condition and log an error message to a channel for all Logger streams on failure. /// /// Use Channel.Assert() instead if you need more control over the channel. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Used to identify the source of a log message so messages can be filtered out. /// Condition you expect to be true. /// Message to log. [Conditional(HT_LOGGER_ASSERT_ON)] public void ChannelAssert(string channel, bool condition, object message) { InternalAssert(channel, condition, message); } /// /// Log an assertion message to a channel for all Logger streams. /// /// Use Channel.LogAssertion() instead if you need more control over the channel. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. [Conditional(HT_LOGGER_ASSERT_ON)] public void ChannelLogAssertion(string channel, object message) { InternalLogAssertion(channel, message, null); } // // Log with channel and context // /// /// Log a Trace message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogTrace() instead if you need more control over the channel. /// /// Trace logs contain the most detailed messages. These messages may contain sensitive application data. /// These messages are disabled by default and should never be enabled in a production environment. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Trace. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_TRACE_ON)] public void ChannelLogTrace(string channel, object message, UnityEngine.Object context) { InternalLog(GetHelperChannel(channel), message, ELogLevel.Trace, context); } /// /// Log a Debug message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogDebug() instead if you need more control over the channel. /// /// Debug logs are used for interactive investigation during development. These logs should primarily contain information useful /// for debugging and have no long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Debug or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_DEBUG_ON)] public void ChannelLogDebug(string channel, object message, UnityEngine.Object context) { InternalLog(GetHelperChannel(channel), message, ELogLevel.Debug, context); } /// /// Log an Information message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogInformation() instead if you need more control over the channel. /// /// Information logs track the general flow of the application (breadcrumbs). These logs should have long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Information or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_INFORMATION_ON)] public void ChannelLogInformation(string channel, object message, UnityEngine.Object context) { InternalLog(GetHelperChannel(channel), message, ELogLevel.Information, context); } /// /// Log a Warning message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogWarning<()/c> instead if you need more control over the channel. /// /// Warning logs highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Warning or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_WARNING_ON)] public void ChannelLogWarning(string channel, object message, UnityEngine.Object context) { InternalLog(GetHelperChannel(channel), message, ELogLevel.Warning, context); } /// /// Log an Error message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogError() instead if you need more control over the channel. /// /// Error logs highlight when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Error or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_ERROR_ON)] public void ChannelLogError(string channel, object message, UnityEngine.Object context) { InternalLog(GetHelperChannel(channel), message, ELogLevel.Error, context); } /// /// Log a Critical message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogCritical() instead if you need more control over the channel. /// /// Critical logs describe an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Critical or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_CRITICAL_ON)] public void ChannelLogCritical(string channel, object message, UnityEngine.Object context) { InternalLog(GetHelperChannel(channel), message, ELogLevel.Critical, context); } /// /// Assert a condition, log an error message to a channel for all Logger streams on failure and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.Assert() instead if you need more control over the channel. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Used to identify the source of a log message so messages can be filtered out. /// Condition you expect to be true. /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_ASSERT_ON)] public void ChannelAssert(string channel, bool condition, object message, UnityEngine.Object context) { InternalAssert(channel, condition, message, context); } /// /// Log an assertion message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogAssertion() instead if you need more control over the channel. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Used to identify the source of a log message so messages can be filtered out. /// Message to log. /// Object to which the message applies. [Conditional(HT_LOGGER_ASSERT_ON)] public void ChannelLogAssertion(string channel, object message, UnityEngine.Object context) { InternalLogAssertion(channel, message, context); } // // Log with channel and format // /// /// Log a formated Trace message to a channel for all Logger streams. /// /// Use Channel.LogTraceFormat() instead if you need more control over the channel. /// /// Trace logs contain the most detailed messages. These messages may contain sensitive application data. /// These messages are disabled by default and should never be enabled in a production environment. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Trace. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_TRACE_ON)] public void ChannelLogTraceFormat(string channel, string format, params object[] args) { InternalLog(GetHelperChannel(channel), string.Format(format, args), ELogLevel.Trace); } /// /// Log a formatted Debug message to a channel for all Logger streams. /// /// Use Channel.LogDebugFormat() instead if you need more control over the channel. /// /// Debug logs are used for interactive investigation during development. These logs should primarily contain information useful /// for debugging and have no long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Debug or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_DEBUG_ON)] public void ChannelLogDebugFormat(string channel, string format, params object[] args) { InternalLog(GetHelperChannel(channel), string.Format(format, args), ELogLevel.Debug); } /// /// Log a formatted Information message to a channel for all Logger streams. /// /// Use Channel.LogInformationFormat() instead if you need more control over the channel. /// /// Information logs track the general flow of the application (breadcrumbs). These logs should have long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Information or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_INFORMATION_ON)] public void ChannelLogInformationFormat(string channel, string format, params object[] args) { InternalLog(GetHelperChannel(channel), string.Format(format, args), ELogLevel.Information); } /// /// Log a formatted Warning message to a channel for all Logger streams. /// /// Use Channel.LogWarningFormat() instead if you need more control over the channel. /// /// Warning logs highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Warning or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_WARNING_ON)] public void ChannelLogWarningFormat(string channel, string format, params object[] args) { InternalLog(GetHelperChannel(channel), string.Format(format, args), ELogLevel.Warning); } /// /// Log a formatted Error message to a channel for all Logger streams. /// /// Use Channel.LogErrorFormat() instead if you need more control over the channel. /// /// Error logs highlight when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Error or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_ERROR_ON)] public void ChannelLogErrorFormat(string channel, string format, params object[] args) { InternalLog(GetHelperChannel(channel), string.Format(format, args), ELogLevel.Error); } /// /// Log a formatted Critical message to a channel for all Logger streams. /// /// Use Channel.LogCriticalFormat() instead if you need more control over the channel. /// /// Critical logs describe an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Critical or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_CRITICAL_ON)] public void ChannelLogCriticalFormat(string channel, string format, params object[] args) { InternalLog(GetHelperChannel(channel), string.Format(format, args), ELogLevel.Critical); } /// /// Assert a condition and log a formatted error message to a channel for all Logger streams on failure. /// /// Use Channel.AssertFormat() instead if you need more control over the channel. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Used to identify the source of a log message so messages can be filtered out. /// Condition you expect to be true. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_ASSERT_ON)] public void ChannelAssertFormat(string channel, bool condition, string format, params object[] args) { InternalAssert(channel, condition, string.Format(format, args)); } /// /// Log a formatted assertion message to a channel for all Logger streams. /// /// Use Channel.LogAssertion() instead if you need more control over the channel. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Used to identify the source of a log message so messages can be filtered out. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_ASSERT_ON)] public void ChannelLogAssertion(string channel, string format, params object[] args) { InternalLogAssertion(channel, string.Format(format, args), null); } // // Log with channel, context and format // /// /// Log a formated Trace message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogTraceFormat() instead if you need more control over the channel. /// /// Trace logs contain the most detailed messages. These messages may contain sensitive application data. /// These messages are disabled by default and should never be enabled in a production environment. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Trace. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_TRACE_ON)] public void ChannelLogTraceFormat(string channel, UnityEngine.Object context, string format, params object[] args) { InternalLog(GetHelperChannel(channel), string.Format(format, args), ELogLevel.Trace, context); } /// /// Log a formatted Debug message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogDebugFormat() instead if you need more control over the channel. /// /// Debug logs are used for interactive investigation during development. These logs should primarily contain information useful /// for debugging and have no long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Debug or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_DEBUG_ON)] public void ChannelLogDebugFormat(string channel, UnityEngine.Object context, string format, params object[] args) { InternalLog(GetHelperChannel(channel), string.Format(format, args), ELogLevel.Debug, context); } /// /// Log a formatted Information message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogInformationFormat() instead if you need more control over the channel. /// /// Information logs track the general flow of the application (breadcrumbs). These logs should have long-term value. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Information or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_INFORMATION_ON)] public void ChannelLogInformationFormat(string channel, UnityEngine.Object context, string format, params object[] args) { InternalLog(GetHelperChannel(channel), string.Format(format, args), ELogLevel.Information, context); } /// /// Log a formatted Warning message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogWarningFormat() instead if you need more control over the channel. /// /// Warning logs highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Warning or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_WARNING_ON)] public void ChannelLogWarningFormat(string channel, UnityEngine.Object context, string format, params object[] args) { InternalLog(GetHelperChannel(channel), string.Format(format, args), ELogLevel.Warning, context); } /// /// Log a formatted Error message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogErrorFormat() instead if you need more control over the channel. /// /// Error logs highlight when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Error or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_ERROR_ON)] public void ChannelLogErrorFormat(string channel, UnityEngine.Object context, string format, params object[] args) { InternalLog(GetHelperChannel(channel), string.Format(format, args), ELogLevel.Error, context); } /// /// Log a formatted Critical message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogCriticalFormat() instead if you need more control over the channel. /// /// Critical logs describe an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention. /// /// Note that this method works only if LoggerProperty.MinLogLevel is ELogLevel.Critical or less. Otherwise this method and the calls to /// this method will be stripped out avoiding all impact in performance and build size. /// /// More information on deciding the log level to use here: /// https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0 /// /// Used to identify the source of a log message so messages can be filtered out. /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_CRITICAL_ON)] public void ChannelLogCriticalFormat(string channel, UnityEngine.Object context, string format, params object[] args) { InternalLog(GetHelperChannel(channel), string.Format(format, args), ELogLevel.Critical, context); } /// /// Assert a condition, log a formatted error message to a channel for all Logger streams on failure and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.AssertFormat() instead if you need more control over the channel. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Used to identify the source of a log message so messages can be filtered out. /// Condition you expect to be true. /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_ASSERT_ON)] public void ChannelAssertFormat(string channel, bool condition, UnityEngine.Object context, string format, params object[] args) { InternalAssert(channel, condition, string.Format(format, args), context); } /// /// Log a formatted assertion message to a channel for all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// Use Channel.LogAssertion() instead if you need more control over the channel. /// /// Note that this method works only if LoggerProperty.IsAssertEnabled is enabled. Otherwise this method and the calls to this method will be /// stripped out avoiding all impact in performance and build size. /// /// /// Used to identify the source of a log message so messages can be filtered out. /// Object to which the message applies. /// A composite format string. /// Format arguments. [Conditional(HT_LOGGER_ASSERT_ON)] public void ChannelLogAssertion(string channel, UnityEngine.Object context, string format, params object[] args) { InternalLogAssertion(channel, string.Format(format, args), context); } } }