Macros
logging.h File Reference
#include <chrono>
#include <console_bridge/console.h>
#include <sstream>
#include <fmt/format.h>
#include <fmt/ostream.h>
Include dependency graph for logging.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PSENSCAN_DEBUG(name, ...)   PSENSCAN_LOG(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_DEBUG, __VA_ARGS__)
 
#define PSENSCAN_DEBUG_ONCE(name, ...)   PSENSCAN_LOG_ONCE(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_DEBUG, __VA_ARGS__)
 
#define PSENSCAN_DEBUG_THROTTLE(period, name, ...)   PSENSCAN_LOG_THROTTLE(period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_DEBUG, __VA_ARGS__)
 
#define PSENSCAN_DEBUG_THROTTLE_INTERNAL(now, period, name, ...)   PSENSCAN_LOG_THROTTLE_INTERNAL(now, period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_DEBUG, __VA_ARGS__)
 
#define PSENSCAN_ERROR(name, ...)   PSENSCAN_LOG(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_ERROR, __VA_ARGS__)
 
#define PSENSCAN_ERROR_ONCE(name, ...)   PSENSCAN_LOG_ONCE(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_ERROR, __VA_ARGS__)
 
#define PSENSCAN_ERROR_THROTTLE(period, name, ...)   PSENSCAN_LOG_THROTTLE(period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_ERROR, __VA_ARGS__)
 
#define PSENSCAN_ERROR_THROTTLE_INTERNAL(now, period, name, ...)   PSENSCAN_LOG_THROTTLE_INTERNAL(now, period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_ERROR, __VA_ARGS__)
 
#define PSENSCAN_INFO(name, ...)   PSENSCAN_LOG(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_INFO, __VA_ARGS__)
 
#define PSENSCAN_INFO_ONCE(name, ...)   PSENSCAN_LOG_ONCE(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_INFO, __VA_ARGS__)
 
#define PSENSCAN_INFO_THROTTLE(period, name, ...)   PSENSCAN_LOG_THROTTLE(period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_INFO, __VA_ARGS__)
 
#define PSENSCAN_INFO_THROTTLE_INTERNAL(now, period, name, ...)   PSENSCAN_LOG_THROTTLE_INTERNAL(now, period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_INFO, __VA_ARGS__)
 
#define PSENSCAN_LOG(name, file, line, level, ...)
 
#define PSENSCAN_LOG_ONCE(name, file, line, level, ...)
 
#define PSENSCAN_LOG_THROTTLE(period, name, file, line, level, ...)   PSENSCAN_LOG_THROTTLE_INTERNAL(std::chrono::system_clock::now(), period, name, file, line, level, __VA_ARGS__)
 
#define PSENSCAN_LOG_THROTTLE_INTERNAL(now, period, name, file, line, level, ...)
 
#define PSENSCAN_WARN(name, ...)   PSENSCAN_LOG(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_WARN, __VA_ARGS__)
 
#define PSENSCAN_WARN_ONCE(name, ...)   PSENSCAN_LOG_ONCE(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_WARN, __VA_ARGS__)
 
#define PSENSCAN_WARN_THROTTLE(period, name, ...)   PSENSCAN_LOG_THROTTLE(period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_WARN, __VA_ARGS__)
 
#define PSENSCAN_WARN_THROTTLE_INTERNAL(now, period, name, ...)   PSENSCAN_LOG_THROTTLE_INTERNAL(now, period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_WARN, __VA_ARGS__)
 

Macro Definition Documentation

◆ PSENSCAN_DEBUG

#define PSENSCAN_DEBUG (   name,
  ... 
)    PSENSCAN_LOG(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_DEBUG, __VA_ARGS__)

Definition at line 63 of file logging.h.

◆ PSENSCAN_DEBUG_ONCE

#define PSENSCAN_DEBUG_ONCE (   name,
  ... 
)    PSENSCAN_LOG_ONCE(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_DEBUG, __VA_ARGS__)

Definition at line 87 of file logging.h.

◆ PSENSCAN_DEBUG_THROTTLE

#define PSENSCAN_DEBUG_THROTTLE (   period,
  name,
  ... 
)    PSENSCAN_LOG_THROTTLE(period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_DEBUG, __VA_ARGS__)

Definition at line 80 of file logging.h.

◆ PSENSCAN_DEBUG_THROTTLE_INTERNAL

#define PSENSCAN_DEBUG_THROTTLE_INTERNAL (   now,
  period,
  name,
  ... 
)    PSENSCAN_LOG_THROTTLE_INTERNAL(now, period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_DEBUG, __VA_ARGS__)

Definition at line 71 of file logging.h.

◆ PSENSCAN_ERROR

#define PSENSCAN_ERROR (   name,
  ... 
)    PSENSCAN_LOG(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_ERROR, __VA_ARGS__)

Definition at line 60 of file logging.h.

◆ PSENSCAN_ERROR_ONCE

#define PSENSCAN_ERROR_ONCE (   name,
  ... 
)    PSENSCAN_LOG_ONCE(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_ERROR, __VA_ARGS__)

Definition at line 83 of file logging.h.

◆ PSENSCAN_ERROR_THROTTLE

#define PSENSCAN_ERROR_THROTTLE (   period,
  name,
  ... 
)    PSENSCAN_LOG_THROTTLE(period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_ERROR, __VA_ARGS__)

Definition at line 74 of file logging.h.

◆ PSENSCAN_ERROR_THROTTLE_INTERNAL

#define PSENSCAN_ERROR_THROTTLE_INTERNAL (   now,
  period,
  name,
  ... 
)    PSENSCAN_LOG_THROTTLE_INTERNAL(now, period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_ERROR, __VA_ARGS__)

Definition at line 65 of file logging.h.

◆ PSENSCAN_INFO

#define PSENSCAN_INFO (   name,
  ... 
)    PSENSCAN_LOG(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_INFO, __VA_ARGS__)

Definition at line 61 of file logging.h.

◆ PSENSCAN_INFO_ONCE

#define PSENSCAN_INFO_ONCE (   name,
  ... 
)    PSENSCAN_LOG_ONCE(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_INFO, __VA_ARGS__)

Definition at line 85 of file logging.h.

◆ PSENSCAN_INFO_THROTTLE

#define PSENSCAN_INFO_THROTTLE (   period,
  name,
  ... 
)    PSENSCAN_LOG_THROTTLE(period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_INFO, __VA_ARGS__)

Definition at line 76 of file logging.h.

◆ PSENSCAN_INFO_THROTTLE_INTERNAL

#define PSENSCAN_INFO_THROTTLE_INTERNAL (   now,
  period,
  name,
  ... 
)    PSENSCAN_LOG_THROTTLE_INTERNAL(now, period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_INFO, __VA_ARGS__)

Definition at line 67 of file logging.h.

◆ PSENSCAN_LOG

#define PSENSCAN_LOG (   name,
  file,
  line,
  level,
  ... 
)
Value:
do \
{ \
console_bridge::log(file, line, level, fmt::format("{}: {}", name, fmt::format(__VA_ARGS__)).c_str()); \
} while (false)

Definition at line 26 of file logging.h.

◆ PSENSCAN_LOG_ONCE

#define PSENSCAN_LOG_ONCE (   name,
  file,
  line,
  level,
  ... 
)
Value:
do \
{ \
static bool already_logged = false; \
if (!already_logged) \
{ \
console_bridge::log(file, line, level, fmt::format("{}: {}", name, fmt::format(__VA_ARGS__)).c_str()); \
already_logged = true; \
} \
} while (false)

Definition at line 32 of file logging.h.

◆ PSENSCAN_LOG_THROTTLE

#define PSENSCAN_LOG_THROTTLE (   period,
  name,
  file,
  line,
  level,
  ... 
)    PSENSCAN_LOG_THROTTLE_INTERNAL(std::chrono::system_clock::now(), period, name, file, line, level, __VA_ARGS__)

Definition at line 43 of file logging.h.

◆ PSENSCAN_LOG_THROTTLE_INTERNAL

#define PSENSCAN_LOG_THROTTLE_INTERNAL (   now,
  period,
  name,
  file,
  line,
  level,
  ... 
)
Value:
do \
{ \
static std::chrono::system_clock::time_point throttle_last_hit; \
auto throttle_now = now; \
if (throttle_last_hit + std::chrono::duration<double>(period) < throttle_now) \
{ \
throttle_last_hit = throttle_now; \
PSENSCAN_LOG(name, file, line, level, __VA_ARGS__); \
} \
} while (false)

Definition at line 46 of file logging.h.

◆ PSENSCAN_WARN

#define PSENSCAN_WARN (   name,
  ... 
)    PSENSCAN_LOG(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_WARN, __VA_ARGS__)

Definition at line 62 of file logging.h.

◆ PSENSCAN_WARN_ONCE

#define PSENSCAN_WARN_ONCE (   name,
  ... 
)    PSENSCAN_LOG_ONCE(name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_WARN, __VA_ARGS__)

Definition at line 86 of file logging.h.

◆ PSENSCAN_WARN_THROTTLE

#define PSENSCAN_WARN_THROTTLE (   period,
  name,
  ... 
)    PSENSCAN_LOG_THROTTLE(period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_WARN, __VA_ARGS__)

Definition at line 78 of file logging.h.

◆ PSENSCAN_WARN_THROTTLE_INTERNAL

#define PSENSCAN_WARN_THROTTLE_INTERNAL (   now,
  period,
  name,
  ... 
)    PSENSCAN_LOG_THROTTLE_INTERNAL(now, period, name, __FILE__, __LINE__, CONSOLE_BRIDGE_LOG_WARN, __VA_ARGS__)

Definition at line 69 of file logging.h.



psen_scan_v2
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Jun 22 2024 02:46:12