NOA DebuggerNOA Debugger
  • v1.7.0
  • v1.6.1
  • v1.5.0
  • v1.4.0
  • v1.3.0
  • v1.2.0
  • v1.1.1
  • v1.0.0
Demo
Contact
Buy
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • v1.7.0
  • v1.6.1
  • v1.5.0
  • v1.4.0
  • v1.3.0
  • v1.2.0
  • v1.1.1
  • v1.0.0
Demo
Contact
Buy
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • NoaConsoleLog

NoaConsoleLog

Through this class, you can obtain logs held by the ConsoleLog feature.

APIs

Static Methods

APIDescription
Add(LogType, message, stackTrace)Adds a log to be output to the ConsoleLog tool. If stackTrace is not specified, it automatically retrieves the stack trace.
Clear()Deletes all stored log information at once.
SetDownloadCallbacks(commonCallbacks, consoleLogCallbacks)Configure download-related events by creating a custom class and passing it as an argument. For detailed information about the argument, please refer to NoaDownloadCallbacks and NoaConsoleLogDownloadCallbacks.

Static Properties

APIDescription
LogListReturns a list of the log information it retains.
OnErrorThis is an event that runs when an error is detected.
OnFilterErrorNotificationThis is a delegate that determines whether to display notifications when an error is detected. It will display notifications if it returns true. Please refer to the sample code for specific usage.
OnLogCopiedThis event is triggered when a log is copied to the clipboard.
OnLogSendThis event is triggered when a log is sent.
It fires when the [send Send] button of the ConsoleLog tool is clicked.

Sample Code

using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
#if NOA_DEBUGGER
using NoaDebugger;
#endif

public class Example
{
    void ExampleMethod()
    {
#if NOA_DEBUGGER

        // Get a list of log information retained by the ConsoleLog function.
        LinkedList<ConsoleLogEntry> consoleLogList = NoaConsoleLog.LogList;

        // Add logs to the ConsoleLog function.
        NoaConsoleLog.Add(UnityEngine.LogType.Error, "log_message", "log_stacktrace");

        // Add logs to the ConsoleLog function (without stack trace).
        NoaConsoleLog.Add(UnityEngine.LogType.Error, "log_message");

        // Add logs from a background thread.
        Task.Run(() => NoaConsoleLog.Add(UnityEngine.LogType.Error, "log_message"));

        // Set the events to be executed when downloading logs using a custom-defined class.
        var downloader = new ExampleDownloader();
        var consoleLogDownloader = new ExampleConsoleLogDownloader();
        NoaConsoleLog.SetDownloadCallbacks(downloader, consoleLogDownloader);

        // Set an event to be executed when an error is detected.
        NoaConsoleLog.OnError += (ConsoleLogEntry log) => Debug.Log("Error detected.");

        // Set a delegate to determine whether to display notifications when an error is detected.
        NoaConsoleLog.OnFilterErrorNotification += (ConsoleLogEntry log) => log.LogString.StartsWith("Log to notify an error.");

        // Set up the event that is triggered when a log is copied to the clipboard.
        NoaConsoleLog.OnLogCopied += (ConsoleLogEntry log, string clipboardText) => Debug.Log($"Log copied. Clipboard: {clipboardText}");


        // Set up the event that is triggered when a log is sent.
        NoaConsoleLog.OnLogSend += (List<ConsoleLogEntry> logList) => Debug.Log("Log sent.");

        // Delete all logs.
        NoaConsoleLog.Clear();
#endif
    }
}