Logger#
-
class EdgeLLMLogger : public nvinfer1::ILogger#
Enhanced Logger with automatic location tracking and nvinfer1 compatibility.
Features:
Automatic source location tracking (file:line:function)
Configurable formatting (timestamps, location info)
nvinfer1::ILogger interface for TensorRT integration
Multiple log levels with performance optimizations
Public Functions
-
EdgeLLMLogger(EdgeLLMLogger const&) = delete#
-
EdgeLLMLogger &operator=(EdgeLLMLogger const&) = delete#
-
EdgeLLMLogger(EdgeLLMLogger&&) = delete#
-
EdgeLLMLogger &operator=(EdgeLLMLogger&&) = delete#
- inline void log(
- nvinfer1::ILogger::Severity severity,
- char const *msg,
nvinfer1::ILogger interface implementation for TensorRT integration
- Parameters:
severity – Log severity level
msg – Log message
- inline void logWithLocation(
- nvinfer1::ILogger::Severity level,
- std::string const &msg,
- SourceLocation const &loc,
Core logging function with automatic location tracking and formatting.
- Parameters:
level – Log severity level
msg – Log message
loc – Source location information
-
inline void debug(std::string const &msg, SourceLocation const &loc)#
Log debug message with location tracking.
- Parameters:
msg – Log message
loc – Source location information
-
inline void info(std::string const &msg, SourceLocation const &loc)#
Log info message with location tracking.
- Parameters:
msg – Log message
loc – Source location information
- inline void warning(
- std::string const &msg,
- SourceLocation const &loc,
Log warning message with location tracking.
- Parameters:
msg – Log message
loc – Source location information
-
inline void error(std::string const &msg, SourceLocation const &loc)#
Log error message with location tracking.
- Parameters:
msg – Log message
loc – Source location information
-
inline void setLevel(nvinfer1::ILogger::Severity level) noexcept#
Set minimum logging level.
- Parameters:
level – Minimum severity level to log
-
inline nvinfer1::ILogger::Severity getLevel() const noexcept#
Get current logging level.
- Returns:
Current minimum severity level
-
inline void setShowTimestamp(bool show) noexcept#
Configure whether to show timestamps in log output.
- Parameters:
show – true to show timestamps, false to hide
-
inline void setShowLocation(bool show) noexcept#
Configure whether to show location info in log output.
- Parameters:
show – true to show location, false to hide
-
inline void setShowFunction(bool show) noexcept#
Configure whether to show function names in log output.
- Parameters:
show – true to show function names, false to hide
Public Static Functions
-
static inline EdgeLLMLogger &instance() noexcept#
Access the process-wide logger singleton.
The instance is intentionally never destroyed (immortal singleton). TensorRT retains a reference to this ILogger inside its global plugin registry, which is a process-lifetime singleton. If the logger were destroyed at static-destruction time (as a normal global object is), the registry could still emit through it from another thread during runtime teardown or plugin-creator lookup, causing a use-after-free. Never destructing the logger removes that race. The single fixed allocation is reclaimed by the OS at process exit; the pointer stays reachable, so it is not a growing leak.
The function-local static also makes construction thread-safe and immune to the static initialization order fiasco (constructed on first use).
- Returns:
Reference to the singleton logger
-
class ScopedFunctionTracer#
RAII-based function tracer for automatic entry/exit logging.
Creates automatic log messages when entering and exiting a scope. Useful for tracing function execution flow.
Public Functions
- inline ScopedFunctionTracer(
- EdgeLLMLogger &logger,
- char const *funcName,
- SourceLocation const &loc,
Constructor that logs function entry.
- Parameters:
logger – Logger instance to use
funcName – Name of the function being traced
loc – Source location information
-
inline ~ScopedFunctionTracer() noexcept#
Destructor that logs function exit.
-
struct SourceLocation#
Source code location information for automatic tracking.
Captures file, function, and line number information for logging.
Public Functions
- inline SourceLocation(
- char const *f,
- char const *func,
- int32_t l,
Constructor with manual location capture.
- Parameters:
f – Source file path
func – Function name
l – Line number