17#define LOG_DEBUG(format, ...) Log::instance()->writeMessage(Log::DebugInfo, format, ##__VA_ARGS__)
18#define LOG_INFO(format, ...) Log::instance()->writeMessage(Log::Info, format, ##__VA_ARGS__)
19#define LOG_ERROR(format, ...) Log::instance()->writeMessage(Log::Error, format, ##__VA_ARGS__)
20#define LOG_WARN(format, ...) Log::instance()->writeMessage(Log::Warning, format, ##__VA_ARGS__)
21#define LOG_USER(format, ...) Log::instance()->writeMessage(Log::User, format, ##__VA_ARGS__)
22#define LOG_DISPLAY(format, ...) Log::instance()->writeMessage(Log::Display, format, ##__VA_ARGS__)
29 m.
text = std::string(format);
30 time_t t = time(NULL);
31 m.
when = localtime(&t);
35 std::lock_guard<std::mutex> lock(
mtx);
88 static std::mutex mutex;
92 std::lock_guard<std::mutex> tLock(mutex);
123 std::unique_lock<std::mutex> lock(
mtx);
139 strftime(buffer, 9,
"%X", m.when);
#define LOG_WARN(format,...)
#define LOG_INFO(format,...)
#define LOG_DEBUG(format,...)
#define LOG_ERROR(format,...)
#define LOG_USER(format,...)
static void(* receiver)(const Message &)
@ Warning
Warning information.
@ Info
Information to user.
@ DebugInfo
Message with some debug information.
@ Error
Error information while executing something.
std::condition_variable mCondition
static void setLevel(MessageType level)
Set minimum level of message to be logged to file.
static std::queue< Message > sMessageQueue
static std::ofstream sOutputStream
static MessageType sLogLevel
static std::string sOutputFile
void writeMessage(MessageType level, const char *format,...)
static std::atomic< Log * > sLogInstance
static void setUserReceiver(void(*userFunc)(const Message &))
Set user function to receive newly sent messages to logger.
static const std::string & getOutput()
Get the filename of log.
static void sendMessage(MessageType type, const std::string &text)
Add a new message to log.
static void setOutput(const std::string &filename)
Open file where to log the messages.
This is an implementation of AdditiveCCD based on peridyno.