23 #include "pybind11/pybind11.h" 44 auto state = PyGILState_Ensure();
45 PyObject_CallObject(_callable,
nullptr);
46 PyGILState_Release(state);
54 py::class_<Log>
cls(mod,
"Log");
57 cls.def(py::init<>());
60 cls.attr(
"TRACE") = py::int_(5000);
61 cls.attr(
"DEBUG") = py::int_(10000);
62 cls.attr(
"INFO") = py::int_(20000);
63 cls.attr(
"WARN") = py::int_(30000);
64 cls.attr(
"ERROR") = py::int_(40000);
65 cls.attr(
"FATAL") = py::int_(50000);
80 log.
logMsg(log4cxx::Level::toLevel(level),
81 log4cxx::spi::LocationInfo(filename.
c_str(), funcname.
c_str(), lineno), msg.
c_str());
90 cls.def_static(
"getLogger", (
Log(*)(
std::string const&))Log::getLogger);
93 cls.def_static(
"MDCRegisterInit", [](py::function func) {
94 auto handle = func.release();
static Log getDefaultLogger()
Return default logger instance, same as default constructor.
bool isWarnEnabled() const
Check whether the logger is enabled for the WARN Level.
bool isErrorEnabled() const
Check whether the logger is enabled for the ERROR Level.
static void configure()
Explicitly configures log4cxx and initializes logging system.
void logMsg(log4cxx::LevelPtr level, log4cxx::spi::LocationInfo const &location, std::string const &msg)
Method used by LOGS_INFO and similar macros to process a log message.
Log getChild(std::string const &suffix) const
Return a logger which is a descendant to this logger.
callable_wrapper(PyObject *callable)
This static class includes a variety of methods for interacting with the the logging module...
bool isInfoEnabled() const
Check whether the logger is enabled for the INFO Level.
static void MDC(std::string const &key, std::string const &value)
Places a KEY/VALUE pair in the Mapped Diagnostic Context (MDC) for the current thread.
bool isDebugEnabled() const
Check whether the logger is enabled for the DEBUG Level.
LSST DM logging module built on log4cxx.
std::string getName() const
Get the logger name associated with the Log object.
A base class for image defects.
static void MDCRemove(std::string const &key)
Remove the value associated with KEY within the MDC.
int getLevel() const
Retrieve the logging threshold.
void setLevel(int level)
Set the logging threshold to LEVEL.
bool isTraceEnabled() const
Check whether the logger is enabled for the TRACE Level.
bool isEnabledFor(int level) const
Return whether the logging threshold of the logger is less than or equal to LEVEL.
static Log getLogger(Log const &logger)
unsigned lwpID()
Function which returns LWP ID on platforms which support it.
static void configure_prop(std::string const &properties)
Configures log4cxx using a string containing the list of properties, equivalent to configuring from a...
bool isFatalEnabled() const
Check whether the logger is enabled for the FATAL Level.
PYBIND11_MODULE(log, mod)
static int MDCRegisterInit(std::function< void()> function)