FastLED 3.9.15
Loading...
Searching...
No Matches
fl::ScopedLogDisable Class Reference

Detailed Description

RAII class to temporarily disable all logging output.

Creates a scope where all fl::print/flprintln output is suppressed. When the object is destroyed, the previous log level is restored.

Usage:

void runValidation() {
{
fl::ScopedLogDisable guard; // Suppress logging
// ... validation code (FL_DBG, FL_WARN, fl::println suppressed) ...
} // Logging restored when guard goes out of scope
// Or with fl::optional for manual control:
guard.emplace(); // Disable logging
// ... work ...
guard.reset(); // Re-enable logging
Serial.println("JSON result"); // Raw Serial.print bypasses fl:: logging
}
void emplace(T &&value) FL_NOEXCEPT
Emplace with rvalue reference.
Definition optional.h:33
void reset() FL_NOEXCEPT
Definition optional.h:46
RAII class to temporarily disable all logging output.
Definition cstdio.h:65
Optional< T > optional
Definition optional.h:16
#define Serial
Definition serial.h:304

Definition at line 65 of file cstdio.h.

#include <cstdio.h>

Public Member Functions

 ScopedLogDisable () FL_NOEXCEPT
 Constructor - saves current log level and disables logging.
 
 ScopedLogDisable (const ScopedLogDisable &) FL_NOEXCEPT=delete
 
 ScopedLogDisable (ScopedLogDisable &&other) FL_NOEXCEPT
 
 ~ScopedLogDisable () FL_NOEXCEPT
 Destructor - restores previous log level.
 
ScopedLogDisableoperator= (const ScopedLogDisable &) FL_NOEXCEPT=delete
 
ScopedLogDisableoperator= (ScopedLogDisable &&) FL_NOEXCEPT=delete
 

Private Attributes

u8 mPreviousLevel
 

The documentation for this class was generated from the following file: