18 #if defined(__CUDACC__) && defined(_MSC_VER) && __CUDACC_VER_MAJOR__ < 11
19 #ifndef FMT_DEPRECATED
20 #define FMT_DEPRECATED
25 #include <fmt/printf.h>
26 #include <fmt/ranges.h>
27 #if FMT_VERSION >= 100000
31 #define DEFAULT_IO_BUFFER_SIZE 1024
36 #define __FN__ __FUNCSIG__
38 #define __FN__ __PRETTY_FUNCTION__
60 #define LogError(...) \
61 Logger::LogError_(__FILE__, __LINE__, static_cast<const char *>(__FN__), \
72 #define LogWarning(...) \
73 Logger::LogWarning_(__FILE__, __LINE__, static_cast<const char *>(__FN__), \
81 #define LogInfo(...) \
82 Logger::LogInfo_(__FILE__, __LINE__, static_cast<const char *>(__FN__), \
90 #define LogDebug(...) \
91 Logger::LogDebug_(__FILE__, __LINE__, static_cast<const char *>(__FN__), \
144 int highlight_text)
const {
145 std::ostringstream msg;
147 msg << fmt::sprintf(
"%c[%d;%dm", 0x1B, highlight_text,
148 (
int)text_color + 30);
152 msg << fmt::sprintf(
"%c[0;m", 0x1B);
171 void SetPrintFunction(std::function<
void(
const std::string &)> print_fcn);
174 void ResetPrintFunction();
177 const std::function<void(
const std::string &)> GetPrintFunction();
188 template <
typename... Args>
189 static void LogError_ [[noreturn]] (
const char *file,
191 const char *
function,
194 if (
sizeof...(Args) > 0) {
196 file, line,
function,
197 FormatArgs(
format, fmt::make_format_args(args...)));
203 template <
typename... Args>
206 const char *
function,
211 if (
sizeof...(Args) > 0) {
213 file, line,
function,
214 FormatArgs(
format, fmt::make_format_args(args...)));
221 template <
typename... Args>
224 const char *
function,
228 if (
sizeof...(Args) > 0) {
230 file, line,
function,
231 FormatArgs(
format, fmt::make_format_args(args...)));
238 template <
typename... Args>
241 const char *
function,
246 if (
sizeof...(Args) > 0) {
248 file, line,
function,
249 FormatArgs(
format, fmt::make_format_args(args...)));
259 static std::string FormatArgs(
const char *
format, fmt::format_args args) {
260 std::string err_msg = fmt::vformat(
format, args);
263 void VError [[noreturn]] (
const char *file,
265 const char *
function,
266 const std::string &message)
const;
267 void VWarning(
const char *file,
269 const char *
function,
270 const std::string &message)
const;
271 void VInfo(
const char *file,
273 const char *
function,
274 const std::string &message)
const;
275 void VDebug(
const char *file,
277 const char *
function,
278 const std::string &message)
const;
281 std::unique_ptr<Impl> impl_;
312 const std::string &progress_info,
313 bool active =
false);
315 void reset(
size_t expected_count,
316 const std::string &progress_info,
321 void setCurrentCount(
size_t n);
324 const size_t resolution_ = 40;
325 size_t expected_count_;
326 size_t current_count_;
327 std::string progress_info_;
328 size_t progress_pixel_;
filament::Texture::InternalFormat format
Logger class should be used as a global singleton object (GetInstance()).
static void LogWarning_(const char *file, int line, const char *function, const char *format, Args &&...args)
void operator=(Logger const &)=delete
static void LogDebug_(const char *file, int line, const char *function, const char *format, Args &&...args)
Logger(Logger const &)=delete
static void LogInfo_(const char *file, int line, const char *function, const char *format, Args &&...args)
void SetVerbosityLevel(VerbosityLevel verbosity_level)
static Logger & GetInstance()
Get Logger global singleton instance.
VerbosityLevel GetVerbosityLevel() const
Get global verbosity level of CloudViewer.
VerbosityContextManager(VerbosityLevel level)
ccGuiPythonInstance * GetInstance() noexcept
void SetVerbosityLevel(VerbosityLevel level)
VerbosityLevel GetVerbosityLevel()
Get global verbosity level of CloudViewer.
Generic file read and write utility for python interface.
std::function< void(const std::string &)> print_fcn_
std::string ColorString(const std::string &text, TextColor text_color, int highlight_text) const
static std::function< void(const std::string &)> console_print_fcn_
VerbosityLevel verbosity_level_