class Debug

Utility class providing various debug functionality.

Public

Constructors

Debug

Debug() = default

Methods

Log

void Log(const String &message, LogVerbosity verbosity, const String &categoryName)

Logs a new message.

message
The message describing the log entry.
verbosity
Verbosity of the message, determining its importance.
categoryName
Category of the message, determining which system is it relevant to.

ClearLog

void ClearLog(const String &categoryName, LogVerbosity verbosity = LogVerbosity::Any)

Removes all log entries for a specific category and/or verbosity level.

categoryName
Name of the category to clear. Specify null to clear all categories.
verbosity
Verbosity level to clear.

GetLogEntries

Vector<LogEntry> GetLogEntries()

Returns all existing log entries.

GetLog

class Log &GetLog()

Retrieves the Log used by the Debug instance.

WriteAsBmp

void WriteAsBmp(u8 *rawPixels, u32 bytesPerPixel, u32 width, u32 height, const Path &filePath, bool overwrite = true) const

Converts raw pixels into a BMP image and saves it as a file

SaveLog

void SaveLog(const Path &path, SavedLogType type = SavedLogType::HTML) const

Saves a log about the current state of the application to the specified location.

path
Absolute path to the log filename.
type
Format of the saved log.

SaveHtmlLog

void SaveHtmlLog(const Path &path) const

Saves a log about the current state of the application to the specified location as a HTML file.

path
Absolute path to the log filename.

SaveTextLog

void SaveTextLog(const Path &path) const

Saves a log about the current state of the application to the specified location as a text file.

path
Absolute path to the log filename.

SetLogCallback

void SetLogCallback(std::function<bool (const String &, LogVerbosity, const char *)> callback)

This allows setting a log callback that can override the default action in log

Fields

OnLogEntryAdded

Event<void (const LogEntry &)> OnLogEntryAdded

Triggered when a new entry in the log is added.

OnLogModified

Event<void ()> OnLogModified

Triggered whenever one or multiple log entries were added or removed.

Triggers only once per frame.

Internal

Methods

TriggerCallbacksInternal

void TriggerCallbacksInternal()

Triggers callbacks that notify external code that a log entry was added.

Private

Fields

mLogHash

u64 mLogHash

mLog

class Log mLog

mCustomLogCallback

std::function<bool (const String &, LogVerbosity, const char *)> mCustomLogCallback