CatDebug Class Reference

This static class allows the programmer to specify a CategoryIndex, each time a Debug Log used is taken.
Each category may be enabled or disabled individually. Disabled categories, will NOT display Debug Log messages.

Static Public Member Functions

static void AppendToNextLog (int category, params object[] messageObjects)
 This function will store the provided text, and append it to the text of the next call to a Log function. When finally displayed by a Log function, the append-text will be reset to an empty string. This text is not append to error, exception or warning logs. Calling this function multiple times, will grow the prepend text, by appending the passed message to it.
 
static void AppendToNextLog (int category, string message)
 This function will store the provided text, and append it to the text of the next call to a Log function. When finally displayed by a Log function, the append-text will be reset to an empty string. This text is not append to error, exception or warning logs. Calling this function multiple times, will grow the prepend text, by appending the passed message to it.
 
static void AppendToNextLog (string message)
 This function will store the provided text, and associate it with the provided category. However, if all logging for the category is disabled: the function will return immediately, and do nothing. The text will then be prepend to the text of the next call of a Log function with the same category. After be drawn in a log call the append text, for that category, will be cleared. This text is not append to error, exception or warning logs. Calling this function multiple times, will grow the prepend text, by appending the passed message to it.
 
static string GetCategoryName (int category)
 Retrieves the internally stored name of category specified by the provided index. If no name has been stored, it will return and empty, non-null string. While you could use this function to manually setup the categories, if multiple categories are in use, it is recommended that you use the ConditionalDebugRegistrar Class instead, which also saves names and states to storage.
 
static void Log (int category, params object[] message)
 This function will take an array of strings, and if the specified category is enabled, and if a DEBUG build is running, it will concatenate together the strings and send the result to Debug.Log for display. The advantage to passing a comma separated array of strings, rather than a single preformed string, is that concatenation can be avoided, when unnecessary. If addCategoryNameToLog is true, the category name will be prepended to the final string before sending it to Debug.Log
 
static void Log (int category, string message)
 This function will take a single string, and if the category is enabled, and if a DEBUG build is running, it will send it to Debug.Log for display. If addCategoryNameToLog is true, the category name will be prepended to the final string before sending it to Debug.Log
 
static void Log (string categoryName, params string[] message)
 This function takes a set of strings as parameters and uses the first one as the category, the rest are part of the message to be displayed. The message is only displayed if the Category has been registered, and is enabled
 
static void Log (string message)
 This function will take an array of strings, and if a DEBUG build is running, it will concatenate together the strings and send the result to Debug.Log for display.
 
static void LogError (int category, string message)
 This function will take a single string, and if the category is enabled, and if a DEBUG build is running, it will send it to Debug.LogError for display. If addCategoryNameToLog is true, the category name will be prepended to the final string before sending it to Debug.LogError
 
static void LogWarning (int category, string message)
 This function will take a single string, and if the category is enabled, and if a DEBUG build is running, it will send it to Debug.LogWarning for display. If addCategoryNameToLog is true, the category name will be prepended to the final string before sending it to Debug.LogWarning
 
static void PrependToNextLog (int category, params object[] messageObjects)
 This function will store the provided text, and associate it with the provided category. However, if all logging for the category is disabled: the function will return immediately, and do nothing. The text will then be prepend to the text of the next call of a Log function with the same category. After be drawn in a log call the prepend text, for that category, will be cleared. This text is not prepended to error, exception or warning logs. Calling this function multiple times, will grow the prepend text, by appending the passed message to it.
 
static void PrependToNextLog (int category, string message)
 This function will store the provided text, and associate it with the provided category. However, if all logging for the category is disabled: the function will return immediately, and do nothing. The text will then be prepend to the text of the next call of a Log function with the same category. After be drawn in a log call the prepend text, for that category, will be cleared. This text is not prepended to error, exception or warning logs. Calling this function multiple times, will grow the prepend text, by appending the passed message to it.
 
static void PrependToNextLog (string message)
 This function will store the provided text, and prepend it to the text of the next call to a Log function. When finally displayed by a Log function, the prepend text will be reset to an empty string. This text is not prepended to error, exception or warning logs. Calling this function multiple times, will grow the prepend text, by appending the passed message to it.
 

Static Public Attributes

static bool addCategoryNameToLog
 the option controls whether or not categories names will be prepended to log displays.
 
static bool addCategoryNameToLogSingleLine
 the option controls whether or not categories names will be prepended to log displays.
 
static bool alwaysShowWarnings
 stores the state of the alwaysShowWarnings Preference. When true, warning will be displayed, even if logging for the category is disabled.
 
static string debugCategoryEnabledPreferencesKeyBase
 Though not implemented in this class, this static string defines the base key in EditorPrefs. The category's number should be appended to this key base. The preference should be used to store the enabled state of the debug key. (see Vendor Preferences Asset for implementation.)
 
static bool logToFileIncludeStackStrace
 when true, log entries that are not sent to unity console, but ARE sent to a log file, will include the stack trace in the file. When false, stack trace will not be included.