rogue
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
rogue::Logging Class Reference

Structured Rogue logging helper. More...

#include <Logging.h>

Public Member Functions

 Logging (const std::string &name, bool quiet=false)
 Constructs a logger.
 
 ~Logging ()
 Destroys the logger instance.
 
void log (uint32_t level, const char *fmt,...)
 Emits a formatted log message at a specified level.
 
void critical (const char *fmt,...)
 Emits a formatted message at Critical level.
 
void error (const char *fmt,...)
 Emits a formatted message at Error level.
 
void warning (const char *fmt,...)
 Emits a formatted message at Warning level.
 
void info (const char *fmt,...)
 Emits a formatted message at Info level.
 
void debug (const char *fmt,...)
 Emits a formatted message at Debug level.
 
void logThreadId ()
 Emits the current thread id through this logger.
 
const std::string & name () const
 Returns the fully-qualified emitted logger name.
 

Static Public Member Functions

static std::shared_ptr< rogue::Loggingcreate (const std::string &name, bool quiet=false)
 Creates a logger instance.
 
static void setLevel (uint32_t level)
 Sets the global default logging level.
 
static void setFilter (const std::string &filter, uint32_t level)
 Sets name-based filter level override.
 
static void setForwardPython (bool enable)
 Enables or disables forwarding Rogue C++ logs into Python logging.
 
static bool forwardPython ()
 Returns whether Rogue C++ logs are currently forwarded to Python logging.
 
static void setEmitStdout (bool enable)
 Enables or disables direct stdout emission of Rogue C++ logs.
 
static bool emitStdout ()
 Returns whether Rogue C++ logs are currently emitted to stdout.
 
static std::string normalizeName (const std::string &name)
 Normalizes logger names to the emitted Rogue namespace.
 
static void setup_python ()
 Registers Python bindings for Logging.
 

Static Public Attributes

static const uint32_t Critical = 50
 Critical severity level constant.
 
static const uint32_t Error = 40
 Error severity level constant.
 
static const uint32_t Thread = 35
 Thread-trace severity level constant.
 
static const uint32_t Warning = 30
 Warning severity level constant.
 
static const uint32_t Info = 20
 Informational severity level constant.
 
static const uint32_t Debug = 10
 Debug severity level constant.
 

Detailed Description

Structured Rogue logging helper.

Provides leveled logging with global level control and optional name-based filters. Instances are typically created per class/module and reused.

Definition at line 59 of file Logging.h.

Constructor & Destructor Documentation

◆ Logging()

rogue::Logging::Logging ( const std::string &  name,
bool  quiet = false 
)
explicit

Constructs a logger.

This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required.

Parameters
nameLogger name/category.
quietWhen true, suppresses creation banner output.

Definition at line 106 of file Logging.cpp.

◆ ~Logging()

rogue::Logging::~Logging ( )

Destroys the logger instance.

Definition at line 117 of file Logging.cpp.

Member Function Documentation

◆ create()

rogue::LoggingPtr rogue::Logging::create ( const std::string &  name,
bool  quiet = false 
)
static

Creates a logger instance.

Parameter semantics are identical to the constructor; see Logging() for logger initialization details. This static factory is the preferred construction path when the object is shared across Rogue graph connections or exposed to Python. It returns std::shared_ptr ownership compatible with Rogue pointer typedefs.

Parameters
nameLogger name/category.
quietWhen true, suppresses creation banner output.
Returns
Shared logger instance.

Definition at line 95 of file Logging.cpp.

◆ critical()

void rogue::Logging::critical ( const char *  fmt,
  ... 
)

Emits a formatted message at Critical level.

Definition at line 266 of file Logging.cpp.

◆ debug()

void rogue::Logging::debug ( const char *  fmt,
  ... 
)

Emits a formatted message at Debug level.

Definition at line 294 of file Logging.cpp.

◆ emitStdout()

bool rogue::Logging::emitStdout ( )
static

Returns whether Rogue C++ logs are currently emitted to stdout.

Definition at line 186 of file Logging.cpp.

◆ error()

void rogue::Logging::error ( const char *  fmt,
  ... 
)

Emits a formatted message at Error level.

Definition at line 273 of file Logging.cpp.

◆ forwardPython()

bool rogue::Logging::forwardPython ( )
static

Returns whether Rogue C++ logs are currently forwarded to Python logging.

Definition at line 172 of file Logging.cpp.

◆ info()

void rogue::Logging::info ( const char *  fmt,
  ... 
)

Emits a formatted message at Info level.

Definition at line 287 of file Logging.cpp.

◆ log()

void rogue::Logging::log ( uint32_t  level,
const char *  fmt,
  ... 
)

Emits a formatted log message at a specified level.

Parameters
levelSeverity level.
fmtprintf-style format string.

Definition at line 259 of file Logging.cpp.

◆ logThreadId()

void rogue::Logging::logThreadId ( )

Emits the current thread id through this logger.

Definition at line 301 of file Logging.cpp.

◆ name()

const std::string & rogue::Logging::name ( ) const

Returns the fully-qualified emitted logger name.

Definition at line 306 of file Logging.cpp.

◆ normalizeName()

std::string rogue::Logging::normalizeName ( const std::string &  name)
static

Normalizes logger names to the emitted Rogue namespace.

Parameters
nameLogger name or prefix.
Returns
Name prefixed with pyrogue. when required.

Definition at line 100 of file Logging.cpp.

◆ setEmitStdout()

void rogue::Logging::setEmitStdout ( bool  enable)
static

Enables or disables direct stdout emission of Rogue C++ logs.

Parameters
enableWhen false, Rogue C++ logs are not printed directly by the native logger sink.

Definition at line 180 of file Logging.cpp.

◆ setFilter()

void rogue::Logging::setFilter ( const std::string &  filter,
uint32_t  level 
)
static

Sets name-based filter level override.

Parameters
filterLogger-name prefix to match.
levelLevel threshold for matching names.

Definition at line 152 of file Logging.cpp.

◆ setForwardPython()

void rogue::Logging::setForwardPython ( bool  enable)
static

Enables or disables forwarding Rogue C++ logs into Python logging.

Parameters
enableWhen true, emitted C++ log messages are also sent to the Python logging logger with the same fully-qualified name.

Definition at line 166 of file Logging.cpp.

◆ setLevel()

void rogue::Logging::setLevel ( uint32_t  level)
static

Sets the global default logging level.

Parameters
levelNew global level threshold.

Definition at line 143 of file Logging.cpp.

◆ setup_python()

void rogue::Logging::setup_python ( )
static

Registers Python bindings for Logging.

Definition at line 310 of file Logging.cpp.

◆ warning()

void rogue::Logging::warning ( const char *  fmt,
  ... 
)

Emits a formatted message at Warning level.

Definition at line 280 of file Logging.cpp.

Member Data Documentation

◆ Critical

const uint32_t rogue::Logging::Critical = 50
static

Critical severity level constant.

Definition at line 90 of file Logging.h.

◆ Debug

const uint32_t rogue::Logging::Debug = 10
static

Debug severity level constant.

Definition at line 100 of file Logging.h.

◆ Error

const uint32_t rogue::Logging::Error = 40
static

Error severity level constant.

Definition at line 92 of file Logging.h.

◆ Info

const uint32_t rogue::Logging::Info = 20
static

Informational severity level constant.

Definition at line 98 of file Logging.h.

◆ Thread

const uint32_t rogue::Logging::Thread = 35
static

Thread-trace severity level constant.

Definition at line 94 of file Logging.h.

◆ Warning

const uint32_t rogue::Logging::Warning = 30
static

Warning severity level constant.

Definition at line 96 of file Logging.h.


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