SuperDex Physics C++ API
Loading...
Searching...
No Matches
log.h File Reference
#include <mochi_core/mochi_config.h>
#include <array>
#include <cstdarg>
#include <functional>
#include <mutex>
#include <string>

Go to the source code of this file.

Namespaces

namespace  superdex

Macros

#define MOCHI_LOG(...)
#define MOCHI_LOG_ERROR(...)
#define MOCHI_LOG_ERROR_ONCE(...)
#define MOCHI_LOG_IMPL(channel, file, line, ...)
#define MOCHI_LOG_ONCE(...)
#define MOCHI_LOG_ONCE_HELPER(channel, ...)
#define MOCHI_LOG_TO(channel, ...)
#define MOCHI_LOG_VERBOSE(...)
#define MOCHI_LOG_VERBOSE_ONCE(...)
#define MOCHI_LOG_WARNING(...)
#define MOCHI_LOG_WARNING_ONCE(...)

Typedefs

using superdex::LogFn = std::function<void(LogChannel, char const* message, char const* file, int line)>

Enumerations

enum class  superdex::LogChannel {
  superdex::Verbose , superdex::Info , superdex::Warning , superdex::Error ,
  superdex::Count
}

Functions

void superdex::EnableLogChannel (LogChannel channel, bool enable)
void superdex::FlushLog ()
std::string superdex::Format ()
std::string superdex::Format (char const *format,...)
LogFn superdex::GetLogCallback ()
bool superdex::IsLogChannelEnabled (LogChannel channel)
void superdex::Log (LogChannel channel, std::string msg, char const *file, int line, bool newline)
void superdex::SetLogCallback (LogFn fn)

Macro Definition Documentation

◆ MOCHI_LOG

#define MOCHI_LOG ( ...)
Value:
MOCHI_LOG_IMPL(::superdex::LogChannel::Info, __FILE__, __LINE__, __VA_ARGS__)
#define MOCHI_LOG_IMPL(channel, file, line,...)
Definition log.h:89

Definition at line 41 of file log.h.

◆ MOCHI_LOG_ERROR

#define MOCHI_LOG_ERROR ( ...)
Value:
MOCHI_LOG_IMPL(::superdex::LogChannel::Error, __FILE__, __LINE__, __VA_ARGS__)

Definition at line 44 of file log.h.

◆ MOCHI_LOG_ERROR_ONCE

#define MOCHI_LOG_ERROR_ONCE ( ...)
Value:
#define MOCHI_LOG_ONCE_HELPER(channel,...)
Definition log.h:49

Definition at line 59 of file log.h.

◆ MOCHI_LOG_IMPL

#define MOCHI_LOG_IMPL ( channel,
file,
line,
... )
Value:
::superdex::Log(channel, ::superdex::Format(__VA_ARGS__), file, line, true); \
} else { \
}
bool IsLogChannelEnabled(LogChannel channel)
Definition log.h:195
std::string Format(char const *format,...)
Definition log.h:100

Definition at line 89 of file log.h.

◆ MOCHI_LOG_ONCE

#define MOCHI_LOG_ONCE ( ...)
Value:

Definition at line 56 of file log.h.

◆ MOCHI_LOG_ONCE_HELPER

#define MOCHI_LOG_ONCE_HELPER ( channel,
... )
Value:
do { \
[[maybe_unused]] static bool logged_##__LINE__ = [&]() { \
MOCHI_LOG_IMPL(channel, __FILE__, __LINE__, __VA_ARGS__); \
return true; \
}(); \
} while (0)

Definition at line 49 of file log.h.

◆ MOCHI_LOG_TO

#define MOCHI_LOG_TO ( channel,
... )
Value:
MOCHI_LOG_IMPL(channel, __FILE__, __LINE__, __VA_ARGS__)

Definition at line 45 of file log.h.

◆ MOCHI_LOG_VERBOSE

#define MOCHI_LOG_VERBOSE ( ...)
Value:
MOCHI_LOG_IMPL(::superdex::LogChannel::Verbose, __FILE__, __LINE__, __VA_ARGS__)

Definition at line 42 of file log.h.

◆ MOCHI_LOG_VERBOSE_ONCE

#define MOCHI_LOG_VERBOSE_ONCE ( ...)
Value:

Definition at line 57 of file log.h.

◆ MOCHI_LOG_WARNING

#define MOCHI_LOG_WARNING ( ...)
Value:
MOCHI_LOG_IMPL(::superdex::LogChannel::Warning, __FILE__, __LINE__, __VA_ARGS__)

Definition at line 43 of file log.h.

◆ MOCHI_LOG_WARNING_ONCE

#define MOCHI_LOG_WARNING_ONCE ( ...)
Value:

Definition at line 58 of file log.h.