DebugLib

Från Norganna's AddOns

Hoppa till: navigering, sök


DebugLib is a lightweight, embeddable library intended for distribution with other addons. It is distributed with as part of all Auctioneer packages.

DebugLib is designed as a companion wrapper for the nLog developer logging tool. It allows addon code to safely invoke logging functions, which will be captured and displayed if nLog is installed (e.g. if the user is a developer), but which will be ignored (or safely reimplemented) if nLog is not installed (i.e. if it is a regular user installation).

The benefit of using DebugLib is that developers can leave logging code included in their final release products, which is safely ignored by end-users, but continues to provide valuable debugging information to the developer. Additionally, if a user is experiencing a problem which the developer cannot recreate, they can be directed to install the nLog tool, and then they can save and upload their nLog data for inspection by the developer.

Functions Implemented

DebugLib implements the following functions:

  • DebugPrint: a template function which will log a message with parameters to nLog; without nLog, it is silently ignored
  • Assert: a template function which will test a given condition and log a critical error to nLog upon failure; without nLog, the error message is output to the console. This function is intended to be used to help debug intermittent failures.
  • Dump: a library function that allows table variables to be safely enumerated and logged and/or printed. Lua does not provide a native function to output the "values" in a table in a text-printable format, and attempts to do so abstractly can run into issues with stack overflows, string length limitations, and other unexpected errors.

For more information, especially for implementation details, please see the documentation included in the addon code itself.

Personliga verktyg