Instrument Neutral Distributed Interface INDI 2.2.5
indilogger.h File Reference
#include "indiapi.h"
#include "defaultdevice.h"
#include <stdarg.h>
#include <fstream>
#include <ostream>
#include <string>
#include <sstream>
#include <sys/time.h>

Go to the source code of this file.

Classes

class  INDI::Logger
 The Logger class is a simple logger to log messages to file and INDI clients. This is the implementation of a simple logger in C++. It is implemented as a Singleton, so it can be easily called through two DEBUG macros. It is Pthread-safe. It allows to log on both file and screen, and to specify a verbosity threshold for both of them. More...
struct  INDI::Logger::switchinit

Namespaces

namespace  INDI
 Namespace to encapsulate INDI client, drivers, and mediator classes.

Macros

#define DEBUG_CONF(outputFile, configuration, fileVerbosityLevel, screenVerbosityLevel)
 Macro to configure the logger. Example of configuration of the Logger: DEBUG_CONF("outputfile", Logger::file_on|Logger::screen_on, DBG_DEBUG, DBG_ERROR);.
#define DEBUG(priority, msg)
 Macro to print log messages. Example of usage of the Logger: DEBUG(DBG_DEBUG, "hello " << "world");.
#define DEBUGF(priority, msg, ...)
#define DEBUGDEVICE(device, priority, msg)
#define DEBUGFDEVICE(device, priority, msg, ...)
#define LOG_ERROR(txt)
 Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must be defined in the calling scope.
#define LOG_WARN(txt)
#define LOG_INFO(txt)
#define LOG_DEBUG(txt)
#define LOG_EXTRA1(txt)
#define LOG_EXTRA2(txt)
#define LOG_EXTRA3(txt)
#define LOGF_ERROR(fmt, ...)
#define LOGF_WARN(fmt, ...)
#define LOGF_INFO(fmt, ...)
#define LOGF_DEBUG(fmt, ...)
#define LOGF_EXTRA1(fmt, ...)
#define LOGF_EXTRA2(fmt, ...)
#define LOGF_EXTRA3(fmt, ...)

Functions

Logger::loggerConf INDI::operator| (Logger::loggerConf __a, Logger::loggerConf __b)
Logger::loggerConf INDI::operator& (Logger::loggerConf __a, Logger::loggerConf __b)

Macro Definition Documentation

◆ DEBUG

#define DEBUG ( priority,
msg )
Value:
INDI::Logger::getInstance().print(getDeviceName(), priority, __FILE__, __LINE__, msg)
void print(const char *devicename, const unsigned int verbosityLevel, const std::string &sourceFile, const int codeLine, const char *message,...)
static Logger & getInstance()
Method to get a reference to the object (i.e., Singleton) It is a static method.
#define getDeviceName

Macro to print log messages. Example of usage of the Logger: DEBUG(DBG_DEBUG, "hello " << "world");.

Definition at line 56 of file indilogger.h.

◆ DEBUG_CONF

#define DEBUG_CONF ( outputFile,
configuration,
fileVerbosityLevel,
screenVerbosityLevel )
Value:
{ \
Logger::getInstance().configure(outputFile, configuration, fileVerbosityLevel, screenVerbosityLevel); \
}

Macro to configure the logger. Example of configuration of the Logger: DEBUG_CONF("outputfile", Logger::file_on|Logger::screen_on, DBG_DEBUG, DBG_ERROR);.

Definition at line 38 of file indilogger.h.

◆ DEBUGDEVICE

#define DEBUGDEVICE ( device,
priority,
msg )
Value:
INDI::Logger::getInstance().print(device, priority, __FILE__, __LINE__, msg)
hid_device * device

Definition at line 60 of file indilogger.h.

◆ DEBUGF

#define DEBUGF ( priority,
msg,
... )
Value:
INDI::Logger::getInstance().print(getDeviceName(), priority, __FILE__, __LINE__, msg, __VA_ARGS__)
Examples
simplescope.cpp.

Definition at line 57 of file indilogger.h.

◆ DEBUGFDEVICE

#define DEBUGFDEVICE ( device,
priority,
msg,
... )
Value:
INDI::Logger::getInstance().print(device, priority, __FILE__, __LINE__, msg, __VA_ARGS__)

Definition at line 61 of file indilogger.h.

◆ LOG_DEBUG

#define LOG_DEBUG ( txt)
Value:
#define DEBUG(priority, msg)
Macro to print log messages. Example of usage of the Logger: DEBUG(DBG_DEBUG, "hello " << "world");.
Definition indilogger.h:56

Definition at line 75 of file indilogger.h.

◆ LOG_ERROR

#define LOG_ERROR ( txt)
Value:

Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must be defined in the calling scope.

Usage examples: LOG_DEBUG("hello " << "world"); LOGF_WARN("hello %s", "world");

Definition at line 72 of file indilogger.h.

◆ LOG_EXTRA1

#define LOG_EXTRA1 ( txt)
Value:

Definition at line 76 of file indilogger.h.

◆ LOG_EXTRA2

#define LOG_EXTRA2 ( txt)
Value:

Definition at line 77 of file indilogger.h.

◆ LOG_EXTRA3

#define LOG_EXTRA3 ( txt)
Value:

Definition at line 78 of file indilogger.h.

◆ LOG_INFO

#define LOG_INFO ( txt)
Value:
Examples
dome.cpp, simpleccd.cpp, simpledevice.cpp, and simplescope.cpp.

Definition at line 74 of file indilogger.h.

◆ LOG_WARN

#define LOG_WARN ( txt)
Value:
Examples
simpleccd.cpp.

Definition at line 73 of file indilogger.h.

◆ LOGF_DEBUG

#define LOGF_DEBUG ( fmt,
... )
Value:
std::string fmt(const char *fmt,...)
Definition Utils.cpp:241
#define DEBUGF(priority, msg,...)
Definition indilogger.h:57

Definition at line 83 of file indilogger.h.

◆ LOGF_ERROR

#define LOGF_ERROR ( fmt,
... )
Value:

Definition at line 80 of file indilogger.h.

◆ LOGF_EXTRA1

#define LOGF_EXTRA1 ( fmt,
... )
Value:

Definition at line 84 of file indilogger.h.

◆ LOGF_EXTRA2

#define LOGF_EXTRA2 ( fmt,
... )
Value:

Definition at line 85 of file indilogger.h.

◆ LOGF_EXTRA3

#define LOGF_EXTRA3 ( fmt,
... )
Value:

Definition at line 86 of file indilogger.h.

◆ LOGF_INFO

#define LOGF_INFO ( fmt,
... )
Value:
Examples
simplescope.cpp.

Definition at line 82 of file indilogger.h.

◆ LOGF_WARN

#define LOGF_WARN ( fmt,
... )
Value:

Definition at line 81 of file indilogger.h.