using System.Collections.Generic; using System.Diagnostics; using UnityEngine; using Ubisoft; // Use this class if your project already uses Debug.Log() intensely, otherwise using Ubisoft.Hotel.Logger class is the recommended approach. // // This class is responsible for overriding UnityEngine.Debug behaviour in order to extend functionaly and in order to be able to strip out both its methods // implementation and the calls to these methods depending on the symbols defined. // // Case 1: The whole call will be stripped out in the final build so you don't have to worry about the allocation that otherwise concatening those strings would cause // Debug.Log("Message: " + foo); // // Case 2: You need to strip out msg yourself // string msg = "Message " + foo; // Debug.Log(msg); // // Case 3: Calling a Log() method defined by the user won't strip out the call to that method unless the user does it herself by using the same approach as the one described above // UserClass.Log("Message " + foo); public class Debug { private const string DEBUG = "DEBUG"; internal const string HT_LOGGER_ASSERT_ON = HtLogger.HT_LOGGER_ASSERT_ON; internal const string HT_LOGGER_LOG_ON = HtLogger.HT_LOGGER_TRACE_ON; internal const string HT_LOGGER_TRACE_ON = HtLogger.HT_LOGGER_TRACE_ON; internal const string HT_LOGGER_DEBUG_ON = HtLogger.HT_LOGGER_DEBUG_ON; internal const string HT_LOGGER_INFORMATION_ON = HtLogger.HT_LOGGER_INFORMATION_ON; internal const string HT_LOGGER_WARNING_ON = HtLogger.HT_LOGGER_WARNING_ON; internal const string HT_LOGGER_ERROR_ON = HtLogger.HT_LOGGER_ERROR_ON; internal const string HT_LOGGER_CRITICAL_ON = HtLogger.HT_LOGGER_CRITICAL_ON; internal const string HT_LOGGER_EXCEPTION_ON = HtLogger.HT_LOGGER_EXCEPTION_ON; public static readonly List HT_LOGGER_SYMBOLS = new List() { HT_LOGGER_ASSERT_ON, HT_LOGGER_LOG_ON, HT_LOGGER_TRACE_ON, HT_LOGGER_DEBUG_ON, HT_LOGGER_INFORMATION_ON, HT_LOGGER_WARNING_ON, HT_LOGGER_ERROR_ON, HT_LOGGER_CRITICAL_ON }; private static HtLogger s_logger; public static HtLogger Logger { get { if (s_logger == null) { s_logger = HtLogger.Instance; } return s_logger; } } /// /// 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 /// public static HtLogger.Channel CreateChannel(string name, string color = null) { return Logger.CreateChannel(name, color); } public static List Channels { get { return Logger.Channels; } } /// /// 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 static void EnableAllChannels() { Logger.EnableAllChannels(); } /// /// Disable all channels. /// public static void DisableAllChannels() { Logger.DisableAllChannels(); } /// /// 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 static void EnableAllChannelsExcept(HashSet channelNames) { Logger.EnableAllChannelsExcept(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 static void DisableAllChannelsExcept(HashSet channelNames) { Logger.DisableAllChannelsExcept(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 static void EnableAllChannelsExcept(HashSet channels) { Logger.EnableAllChannelsExcept(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 static void DisableAllChannelsExcept(HashSet channels) { Logger.DisableAllChannelsExcept(channels); } // // Assert // // /// 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 static void Assert(bool condition) { Logger.Assert(condition); } // // Log // /// /// Log a Trace message to all Logger streams. /// /// This method exists only to keep compatibility but LogTrace() is preferred since it conforms to Microsoft Logging specifications. /// /// 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_LOG_ON)] public static void Log(object message) { Logger.LogTrace(message); } /// /// 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 static void LogTrace(object message) { Logger.LogTrace(message); } /// /// 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 static void LogDebug(object message) { Logger.LogDebug(message); } /// /// 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 static void LogInformation(object message) { Logger.LogInformation(message); } /// /// 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 static void LogWarning(object message) { Logger.LogWarning(message); } /// /// 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 static void LogError(object message) { Logger.LogError(message); } /// /// 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 static void LogCritical(object message) { Logger.LogCritical(message); } /// /// 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 static void Assert(bool condition, object message) { Logger.Assert(condition, message); } /// /// 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 static void LogAssertion(object message) { Logger.LogAssertion(message); } /// /// 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 static void LogException(System.Exception exception) { Logger.LogException(exception); } // // Log with context // /// /// Log a Trace message to all Logger streams and highlight in the hierarchy the object that the message applies to. /// /// This method exists only to keep compatibility but LogTrace() is preferred since it conforms to Microsoft Logging specifications. /// /// 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_LOG_ON)] public static void Log(object message, Object context) { Logger.LogTrace(message, 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 static void LogTrace(object message, Object context) { Logger.LogTrace(message, 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 static void LogDebug(object message, Object context) { Logger.LogDebug(message, 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 static void LogInformation(object message, Object context) { Logger.LogInformation(message, 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 static void LogWarning(object message, Object context) { Logger.LogWarning(message, 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 static void LogError(object message, Object context) { Logger.LogError(message, 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 static void LogCritical(object message, Object context) { Logger.LogCritical(message, 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 static void Assert(bool condition, object message, Object context) { Logger.Assert(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 static void LogAssertion(object message, Object context) { Logger.LogAssertion(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 static void LogException(System.Exception exception, Object context) { Logger.LogException(exception, context); } // // Log with format // /// /// Log a formated Trace message to all Logger streams. /// /// This method exists only to keep compatibility but LogTraceFormat() is preferred since it conforms to Microsoft Logging specifications. /// /// 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_LOG_ON)] public static void LogFormat(string format, params object[] args) { Logger.LogTraceFormat(format, args); } /// /// 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 static void LogTraceFormat(string format, params object[] args) { Logger.LogTraceFormat(format, args); } /// /// 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 static void LogDebugFormat(string format, params object[] args) { Logger.LogDebugFormat(format, args); } /// /// 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 static void LogInformationFormat(string format, params object[] args) { Logger.LogInformationFormat(format, args); } /// /// 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 static void LogWarningFormat(string format, params object[] args) { Logger.LogWarningFormat(format, args); } /// /// 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 static void LogErrorFormat(string format, params object[] args) { Logger.LogErrorFormat(format, args); } /// /// 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 static void LogCriticalFormat(string format, params object[] args) { Logger.LogCriticalFormat(format, args); } /// /// 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 static void AssertFormat(bool condition, string format, params object[] args) { Logger.AssertFormat(condition, 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 static void LogAssertionFormat(string format, params object[] args) { Logger.LogAssertionFormat(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. /// /// This method exists only to keep compatibility but LogTraceFormat() is preferred since it conforms to Microsoft Logging specifications. /// /// 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_LOG_ON)] public static void LogFormat(Object context, string format, params object[] args) { Logger.LogTraceFormat(context, format, args); } /// /// 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 static void LogTraceFormat(Object context, string format, params object[] args) { Logger.LogTraceFormat(context, format, args); } /// /// 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 static void LogDebugFormat(Object context, string format, params object[] args) { Logger.LogDebugFormat(context, format, args); } /// /// 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 static void LogInformationFormat(Object context, string format, params object[] args) { Logger.LogInformationFormat(context, format, args); } /// /// 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 static void LogWarningFormat(Object context, string format, params object[] args) { Logger.LogWarningFormat(context, format, args); } /// /// 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 static void LogErrorFormat(Object context, string format, params object[] args) { Logger.LogErrorFormat(context, format, args); } /// /// 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 static void LogCriticalFormat(Object context, string format, params object[] args) { Logger.LogCriticalFormat(context, format, args); } /// /// 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 static void AssertFormat(bool condition, Object context, string format, params object[] args) { Logger.AssertFormat(condition, context, format, args); } /// /// 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 static void LogAssertionFormat(Object context, string format, params object[] args) { Logger.LogAssertionFormat(context, format, args); } // // Log with channel // /// /// Log a Trace message to a channel for all Logger streams. /// /// Use ChannelLogger.Trace() 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 static void ChannelLogTrace(string channel, object message) { Logger.ChannelLogTrace(channel, message); } /// /// Log a Debug message to a channel for all Logger streams. /// /// Use ChannelLogger.Debug() 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 static void ChannelLogDebug(string channel, object message) { Logger.ChannelLogDebug(channel, message); } /// /// Log an Information message to a channel for all Logger streams. /// /// Use ChannelLogger.Information() 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 static void ChannelLogInformation(string channel, object message) { Logger.ChannelLogInformation(channel, message); } /// /// Log a Warning message to a channel for all Logger streams. /// /// Use ChannelLogger.Warning() 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 static void ChannelLogWarning(string channel, object message) { Logger.ChannelLogWarning(channel, message); } /// /// Log an Error message to a channel for all Logger streams. /// /// Use ChannelLogger.Error() 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 static void ChannelLogError(string channel, object message) { Logger.ChannelLogError(channel, message); } /// /// Log a Critical message to a channel for all Logger streams. /// /// Use ChannelLogger.Critical() 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 static void ChannelLogCritical(string channel, object message) { Logger.ChannelLogCritical(channel, message); } /// /// Assert a condition and log an error message to a channel for all Logger streams on failure. /// /// Use ChannelLogger.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 static void ChannelAssert(string channel, bool condition, object message) { Logger.ChannelAssert(channel, condition, message); } /// /// Log an assertion message to a channel for all Logger streams. /// /// Use ChannelLogger.Assertion() 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 static void ChannelLogAssertion(string channel, object message) { Logger.ChannelLogAssertion(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 ChannelLogger.Trace() 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 static void ChannelLogTrace(string channel, object message, Object context) { Logger.ChannelLogTrace(channel, message, 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 ChannelLogger.Debug() 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 static void ChannelLogDebug(string channel, object message, Object context) { Logger.ChannelLogDebug(channel, message, 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 ChannelLogger.Information() 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 static void ChannelLogInformation(string channel, object message, Object context) { Logger.ChannelLogInformation(channel, message, 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 ChannelLogger.Warning<()/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 static void ChannelLogWarning(string channel, object message, Object context) { Logger.ChannelLogWarning(channel, message, 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 ChannelLogger.Error() 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 static void ChannelLogError(string channel, object message, Object context) { Logger.ChannelLogError(channel, message, 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 ChannelLogger.Critical() 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 static void ChannelLogCritical(string channel, object message, Object context) { Logger.ChannelLogCritical(channel, message, 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 ChannelLogger.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 static void ChannelAssert(string channel, bool condition, object message, Object context) { Logger.ChannelAssert(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 ChannelLogger.Assertion() 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 static void ChannelLogAssertion(string channel, object message, Object context) { Logger.ChannelLogAssertion(channel, message, context); } // // Log with channel and format // /// /// Log a formated Trace message to a channel for all Logger streams. /// /// Use ChannelLogger.TraceFormat() 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_LOG_ON)] public static void ChannelLogFormat(string channel, string format, params object[] args) { Logger.ChannelLogTraceFormat(channel, format, args); } /// /// Log a formated Trace message to a channel for all Logger streams. /// /// Use ChannelLogger.TraceFormat() 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 static void ChannelLogTraceFormat(string channel, string format, params object[] args) { Logger.ChannelLogTraceFormat(channel, format, args); } /// /// Log a formatted Debug message to a channel for all Logger streams. /// /// Use ChannelLogger.DebugFormat() 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 static void ChannelLogDebugFormat(string channel, string format, params object[] args) { Logger.ChannelLogDebugFormat(channel, format, args); } /// /// Log a formatted Information message to a channel for all Logger streams. /// /// Use ChannelLogger.InformationFormat() 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 static void ChannelLogInformationFormat(string channel, string format, params object[] args) { Logger.ChannelLogInformationFormat(channel, format, args); } /// /// Log a formatted Warning message to a channel for all Logger streams. /// /// Use ChannelLogger.WarningFormat() 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 static void ChannelLogWarningFormat(string channel, string format, params object[] args) { Logger.ChannelLogWarningFormat(channel, format, args); } /// /// Log a formatted Error message to a channel for all Logger streams. /// /// Use ChannelLogger.ErrorFormat() 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 static void ChannelLogErrorFormat(string channel, string format, params object[] args) { Logger.ChannelLogErrorFormat(channel, format, args); } /// /// Log a formatted Critical message to a channel for all Logger streams. /// /// Use ChannelLogger.CriticalFormat() 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 static void ChannelLogCriticalFormat(string channel, string format, params object[] args) { Logger.ChannelLogCriticalFormat(channel, format, args); } /// /// 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 static void ChannelAssertFormat(string channel, bool condition, string format, params object[] args) { Logger.ChannelAssertFormat(channel, condition, format, args); } /// /// Log a formatted assertion message to a channel for all Logger streams. /// /// Use ChannelLogger.Assertion() 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 static void ChannelLogAssertion(string channel, string format, params object[] args) { Logger.ChannelLogAssertion(channel, 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 ChannelLogger.TraceFormat() 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_LOG_ON)] public static void ChannelLogFormat(string channel, Object context, string format, params object[] args) { Logger.ChannelLogTraceFormat(channel, context, format, args); } /// /// 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 ChannelLogger.TraceFormat() 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 static void ChannelLogTraceFormat(string channel, Object context, string format, params object[] args) { Logger.ChannelLogTraceFormat(channel, context, format, args); } /// /// 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 ChannelLogger.DebugFormat() 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 static void ChannelLogDebugFormat(string channel, Object context, string format, params object[] args) { Logger.ChannelLogDebugFormat(channel, context, format, args); } /// /// 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 ChannelLogger.InformationFormat() 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 static void ChannelLogInformationFormat(string channel, Object context, string format, params object[] args) { Logger.ChannelLogInformationFormat(channel, context, format, args); } /// /// 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 ChannelLogger.WarningFormat() 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 static void ChannelLogWarningFormat(string channel, Object context, string format, params object[] args) { Logger.ChannelLogWarningFormat(channel, context, format, args); } /// /// 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 ChannelLogger.ErrorFormat() 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 static void ChannelLogErrorFormat(string channel, Object context, string format, params object[] args) { Logger.ChannelLogErrorFormat(channel, context, format, args); } /// /// 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 ChannelLogger.CriticalFormat() 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 static void ChannelLogCriticalFormat(string channel, Object context, string format, params object[] args) { Logger.ChannelLogCriticalFormat(channel, context, format, args); } /// /// 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 static void ChannelAssertFormat(string channel, bool condition, Object context, string format, params object[] args) { Logger.ChannelAssertFormat(channel, condition, context, format, args); } /// /// 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 ChannelLogger.Assertion() 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 static void ChannelLogAssertion(string channel, Object context, string format, params object[] args) { Logger.ChannelLogAssertion(channel, context, format, args); } [Conditional(DEBUG)] public static void Break() { UnityEngine.Debug.Break(); } [Conditional(DEBUG)] public static void ClearDeveloperConsole() { UnityEngine.Debug.ClearDeveloperConsole(); } public static string FormatTextInCodeContext(string text) { return $"'{text}'"; } public static string FormatTextInUserContext(string text) { return $"'{text}'"; } [Conditional(DEBUG)] public static void DrawLine(Vector3 start, Vector3 end) { UnityEngine.Debug.DrawLine(start, end); } [Conditional(DEBUG)] public static void DrawLine(Vector3 start, Vector3 end, Color color) { UnityEngine.Debug.DrawLine(start, end, color); } [Conditional(DEBUG)] public static void DrawLine(Vector3 start, Vector3 end, Color color, float duration) { UnityEngine.Debug.DrawLine(start, end, color, duration); } [Conditional(DEBUG)] public static void DrawLine(Vector3 start, Vector3 end, Color color, float duration, bool depthTest) { UnityEngine.Debug.DrawLine(start, end, color, duration, depthTest); } [Conditional(DEBUG)] public static void DrawRay(Vector3 start, Vector3 dir) { UnityEngine.Debug.DrawRay(start, dir); } [Conditional(DEBUG)] public static void DrawRay(Vector3 start, Vector3 dir, Color color) { UnityEngine.Debug.DrawRay(start, dir, color); } [Conditional(DEBUG)] public static void DrawRay(Vector3 start, Vector3 dir, Color color, float duration) { UnityEngine.Debug.DrawRay(start, dir, color, duration); } [Conditional(DEBUG)] public static void DrawRay(Vector3 start, Vector3 dir, Color color, float duration, bool depthTest) { UnityEngine.Debug.DrawRay(start, dir, color, duration, depthTest); } #if UNITY_EDITOR /// /// Collection of methods that won't be stripped out. Use these methods for logging from inhouse Editor tools, /// /// #region editor public static void EditorLog(string msg) { UnityEngine.Debug.Log(msg); } public static void EditorLogFormat(string format, params object[] args) { EditorLog(string.Format(format, args)); } public static void EditorLogWarning(string msg) { UnityEngine.Debug.LogWarning(msg); } public static void EditorLogError(string msg) { UnityEngine.Debug.LogError(msg); } public static void EditorLogErrorFormat(string format, params object[] args) { EditorLogError(string.Format(format, args)); } #endregion #endif }