17#ifndef __ROGUE_LOGGING_H__
18#define __ROGUE_LOGGING_H__
61 static uint32_t gblLevel_;
64 static std::mutex levelMtx_;
67 static std::vector<rogue::LogFilter*> filters_;
70 static std::vector<rogue::Logging*> loggers_;
73 static bool forwardPython_;
76 static bool emitStdout_;
78 void intLog(uint32_t level,
const char* format, va_list args);
80 void updateLevelLocked();
83 std::atomic<uint32_t> level_;
92 static const uint32_t
Error = 40;
98 static const uint32_t
Info = 20;
116 static std::shared_ptr<rogue::Logging>
create(
const std::string&
name,
bool quiet =
false);
128 explicit Logging(
const std::string&
name,
bool quiet =
false);
136 static void setLevel(uint32_t level);
143 static void setFilter(
const std::string& filter, uint32_t level);
181 void log(uint32_t level,
const char* fmt, ...);
184 void critical(
const char* fmt, ...);
186 void error(
const char* fmt, ...);
188 void warning(
const char* fmt, ...);
190 void info(
const char* fmt, ...);
192 void debug(
const char* fmt, ...);
198 const std::string&
name()
const;
Per-logger level override filter entry.
LogFilter(std::string name, uint32_t level)
Constructs a filter entry.
uint32_t level_
Minimum enabled level for matching names.
std::string name_
Logger name prefix to match.
Structured Rogue logging helper.
~Logging()
Destroys the logger instance.
void info(const char *fmt,...)
Emits a formatted message at Info level.
static const uint32_t Thread
Thread-trace severity level constant.
static void setEmitStdout(bool enable)
Enables or disables direct stdout emission of Rogue C++ logs.
static bool forwardPython()
Returns whether Rogue C++ logs are currently forwarded to Python logging.
void logThreadId()
Emits the current thread id through this logger.
static void setup_python()
Registers Python bindings for Logging.
static std::shared_ptr< rogue::Logging > create(const std::string &name, bool quiet=false)
Creates a logger instance.
static void setForwardPython(bool enable)
Enables or disables forwarding Rogue C++ logs into Python logging.
static bool emitStdout()
Returns whether Rogue C++ logs are currently emitted to stdout.
static void setFilter(const std::string &filter, uint32_t level)
Sets name-based filter level override.
void warning(const char *fmt,...)
Emits a formatted message at Warning level.
const std::string & name() const
Returns the fully-qualified emitted logger name.
static const uint32_t Debug
Debug severity level constant.
void log(uint32_t level, const char *fmt,...)
Emits a formatted log message at a specified level.
static const uint32_t Error
Error severity level constant.
static const uint32_t Info
Informational severity level constant.
static std::string normalizeName(const std::string &name)
Normalizes logger names to the emitted Rogue namespace.
static const uint32_t Warning
Warning severity level constant.
static void setLevel(uint32_t level)
Sets the global default logging level.
void critical(const char *fmt,...)
Emits a formatted message at Critical level.
void debug(const char *fmt,...)
Emits a formatted message at Debug level.
static const uint32_t Critical
Critical severity level constant.
void error(const char *fmt,...)
Emits a formatted message at Error level.
std::shared_ptr< rogue::Logging > LoggingPtr
Shared pointer alias for Logging.