FZGPUModules 2.0
GPU-accelerated modular compression pipelines
Loading...
Searching...
No Matches
fz::Logger Class Reference

#include <log.h>

Static Public Member Functions

static void setCallback (Callback cb)
 
static void setMinLevel (LogLevel level)
 
static void enableStderr (LogLevel min_level=LogLevel::INFO)
 
static void log (LogLevel level, const char *fmt,...)
 
static void print (const char *fmt,...)
 

Detailed Description

Singleton logging interface for FZGPUModules.

Routes all log messages through a single user-supplied callback, enabling redirection to stderr, a file, or a test buffer without recompilation. Log calls below the compile-time FZ_LOG_MIN_LEVEL threshold expand to ((void)0) and have zero runtime cost.

Note
The callback and minimum level are global state. Set them once at startup before launching any pipelines; do not change them while pipelines are running on other threads.

Member Function Documentation

◆ setCallback()

static void fz::Logger::setCallback ( Callback  cb)
inlinestatic

Set the output callback. All log messages at or above the runtime minimum level are forwarded to this function. Pass nullptr to silence all runtime output (compile-time disabled calls are already gone).

◆ setMinLevel()

static void fz::Logger::setMinLevel ( LogLevel  level)
inlinestatic

Set the runtime minimum log level. Messages below this level are dropped even if the compile-time floor allows them. Useful for toggling verbosity at runtime without recompiling.

Note: the effective floor is max(FZ_LOG_MIN_LEVEL, runtime minLevel). Setting a runtime level lower than the compile-time floor has no effect because those call sites are already compiled out.

◆ enableStderr()

static void fz::Logger::enableStderr ( LogLevel  min_level = LogLevel::INFO)
inlinestatic

Convenience: enable logging at or above min_level to stderr. Format: "[fzgmod:LEVEL] message"

◆ log()

static void fz::Logger::log ( LogLevel  level,
const char *  fmt,
  ... 
)
inlinestatic

Emit a log message. Called by the FZ_LOG macro only for levels that passed compile-time gating; do not call directly.

◆ print()

static void fz::Logger::print ( const char *  fmt,
  ... 
)
inlinestatic

Diagnostic output — always emits, not filtered by log level. Used by printDAG(), printBufferLifetimes(), and similar explicit diagnostic helpers that the caller has explicitly invoked.

Routes through the callback (as INFO) if one is set; otherwise writes to stdout so explicit diagnostic calls are never silently swallowed.