ChapterForge
Loading...
Searching...
No Matches
logging.hpp File Reference
#include <algorithm>
#include <atomic>
#include <cerrno>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include <string_view>
#include <system_error>
#include <vector>
#include <cstdint>
Include dependency graph for logging.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  chapterforge
 

Macros

#define CH_LOG(level, message)
 

Enumerations

enum class  chapterforge::LogVerbosity { chapterforge::LogVerbosity::Error = 0 , chapterforge::LogVerbosity::Warn = 1 , chapterforge::LogVerbosity::Info = 2 , chapterforge::LogVerbosity::Debug = 3 }
 

Functions

void chapterforge::set_log_verbosity (LogVerbosity level)
 Set global logging verbosity.
 
LogVerbosity chapterforge::get_log_verbosity ()
 Get current logging verbosity.
 
std::string chapterforge::hex_prefix (const std::vector< uint8_t > &data, size_t max_len=kHexPreviewBytes)
 
constexpr chapterforge::LogVerbosity ch_severity_for_tag (std::string_view tag)
 
bool ch_should_log (const char *level)
 
void ch_log_impl (const char *level, const std::string &msg, const char *file, int line, const char *func)
 

Variables

constexpr size_t chapterforge::kHexPreviewBytes = 8
 

Macro Definition Documentation

◆ CH_LOG

#define CH_LOG (   level,
  message 
)
Value:
do { \
if (ch_should_log(level)) { \
std::ostringstream _ch_log_ss; \
_ch_log_ss << message; \
ch_log_impl(level, _ch_log_ss.str(), __FILE__, __LINE__, \
__func__); \
} \
} while (0)
bool ch_should_log(const char *level)
Definition logging.hpp:66

Function Documentation

◆ ch_log_impl()

void ch_log_impl ( const char *  level,
const std::string &  msg,
const char *  file,
int  line,
const char *  func 
)
inline

◆ ch_severity_for_tag()

constexpr chapterforge::LogVerbosity ch_severity_for_tag ( std::string_view  tag)
inlineconstexpr

◆ ch_should_log()

bool ch_should_log ( const char *  level)
inline