Module nih_plug::debug

source ·
Expand description

Macros for logging and debug assertions. nih_dbg!(), nih_trace!(), and the nih_debug_assert_*!() macros are compiled out during release builds, so they can be used for asserting adiditonal invariants in debug builds. Check the nih_log!() macro for more information on NIH-plug’s logger. None of the logging functions are realtime-safe, and you should avoid using them during release builds in any of the functions that may be called from an audio thread.

Re-exports

Modules

Macros

  • Analogues to the dbg!() macro, but respecting the NIH_LOG environment variable and with all of the same logging features as the other nih_*!() macros. Like the nih_debug_assert*!() macros, this is only shown when compiling in debug mode, but the macro will still return the value in non-debug modes.
  • A debug_assert!() analogue that prints the error with line number information instead of panicking. During tests this is upgraded to a regular panicking debug_assert!().
  • A debug_assert_eq!() analogue that prints the error with line number information instead of panicking. See nih_debug_assert!() for more information.
  • An unconditional debug assertion failure, for if the condition has already been checked elsewhere. See nih_debug_assert!() for more information.
  • A debug_assert_ne!() analogue that prints the error with line number information instead of panicking. See nih_debug_assert!() for more information.
  • Similar to nih_log!(), but more scream-y. Used for printing fatal errors.
  • Write something to the logger. This defaults to STDERR unless the user is running Windows and a debugger has been attached, in which case OutputDebugString() will be used instead.
  • The same as nih_log!(), but with source and thread information. Like the nih_debug_assert*!() macros, this is only shown when compiling in debug mode.
  • Similar to nih_log!(), but less subtle. Used for printing warnings.