BetaTrader
A HFT Eco-System
Loading...
Searching...
No Matches
Runbook.h File Reference
#include "spdlog/fmt/fmt.h"
#include "spdlog/spdlog.h"
#include <stdexcept>
#include <string>
#include "logging/Logger.h"
#include <string_view>
Include dependency graph for Runbook.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  runbook::ErrorDefinition
 

Namespaces

namespace  runbook
 

Macros

#define LOG_CRITICAL(code, ...)
 Logs a critical message with a runbook code.
 
#define LOG_ERROR(code, ...)
 Logs an error message with a runbook code.
 

Functions

template<typename... Args>
static std::string runbook::FormatRunbookLog (const ErrorDefinition &errorDef, const std::string_view &fmt_str, Args &&... args)
 Internal helper function to format the final log message.
 

Macro Definition Documentation

◆ LOG_CRITICAL

#define LOG_CRITICAL (   code,
  ... 
)
Value:
do { \
if (spdlog::default_logger()->should_log(spdlog::level::critical)) { \
spdlog::source_loc loc{__FILE__, __LINE__, __FUNCTION__}; \
std::string msg = runbook::FormatRunbookLog(code, __VA_ARGS__); \
spdlog::default_logger()->log(loc, spdlog::level::critical, \
spdlog::string_view_t(msg)); \
} \
} \
while (0)
static std::string FormatRunbookLog(const ErrorDefinition &errorDef, const std::string_view &fmt_str, Args &&... args)
Internal helper function to format the final log message.
Definition Runbook.h:39

Logs a critical message with a runbook code.

◆ LOG_ERROR

#define LOG_ERROR (   code,
  ... 
)
Value:
do { \
if (spdlog::default_logger()->should_log(spdlog::level::err)) { \
spdlog::source_loc loc{__FILE__, __LINE__, __FUNCTION__}; \
std::string msg = runbook::FormatRunbookLog(code, __VA_ARGS__); \
spdlog::default_logger()->log(loc, spdlog::level::err, \
spdlog::string_view_t(msg)); \
} \
} \
while (0)

Logs an error message with a runbook code.