8 #include <pybind11/native_enum.h>
9 #include <pybind11/pybind11.h>
10 #include <pybind11/stl.h>
11 #include <pybind11/stl_bind.h>
13 #include "../casters.h"
18 using namespace pybind11::literals;
22 py::class_<CVLog> PyccLog(m,
"ccLog", R
"pbdoc(
23 Class to log messages in ACloudViewer's console.
25 Use one of the static method to log a message
27 PyccLog.def_static("TheInstance", &
CVLog::TheInstance, py::return_value_policy::reference);
28 PyccLog.def_static(
"LogMessage", &
CVLog::LogMessage,
"message"_a,
"level"_a, R
"pbdoc(
29 Logs a message with the given level.
35 level: pycc.CVLog.MessageLevelFlags
36 The severity level of the message
42 >>> pycc.CVLog.LogMessage("Hello, world", pycc.CVLog.MessageLevelFlags.LOG_STANDARD)
45 "Print",
static_cast<bool (*)(
const QString &)
>(&
CVLog::Print),
"message"_a, R
"pbdoc(
46 Logs a message with standard severity level.
57 >>> pycc.CVLog.Print("Hello, world")
61 "Warning",
static_cast<bool (*)(
const QString &)
>(&
CVLog::Warning),
"message"_a, R
"pbdoc(
62 Logs a warning message
73 >>> pycc.CVLog.Warning("Oops something bad happenned")
77 "Error",
static_cast<bool (*)(
const QString &)
>(&
CVLog::Error),
"message"_a, R
"pbdoc(
80 This will also display a dialog
91 >>> pycc.CVLog.Error("Oops something even worse happenned")
95 py::native_enum<CVLog::MessageLevelFlags>(
96 PyccLog, "MessageLevelFlags",
"enum.Enum",
"CVLog::MessageLevelFlags.")
97 .value(
"LOG_VERBOSE", CVLog::MessageLevelFlags::LOG_VERBOSE)
98 .value(
"LOG_STANDARD", CVLog::MessageLevelFlags::LOG_STANDARD)
99 .value(
"LOG_IMPORTANT", CVLog::MessageLevelFlags::LOG_IMPORTANT)
100 .value(
"LOG_WARNING", CVLog::MessageLevelFlags::LOG_WARNING)
101 .value(
"LOG_ERROR", CVLog::MessageLevelFlags::LOG_ERROR)
void define_ccLog(py::module &m)
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
static bool Print(const char *format,...)
Prints out a formatted message in console.
static void LogMessage(const QString &message, int level)
Static shortcut to CVLog::logMessage.
static CVLog * TheInstance()
Returns the static and unique instance.
static bool Error(const char *format,...)
Display an error dialog with formatted message.