VaneDB 0.1.0
Embeddable vector database for edge AI
Loading...
Searching...
No Matches
Enumerations | Functions
vanedb::logging Namespace Reference

Enumerations

enum class  Level {
  TRACE = 0 , DEBUG = 1 , INFO = 2 , WARN = 3 ,
  ERROR = 4 , OFF = 5
}
 Log level enumeration. More...
 

Functions

const char * level_to_string (Level level)
 Convert log level to string.
 
Levelglobal_level ()
 Global log level (can be changed at runtime).
 
void set_level (Level level)
 Set the global log level.
 
Level get_level ()
 Get the global log level.
 
std::mutex & log_mutex ()
 Mutex for thread-safe logging.
 
template<typename T >
void format_kv (std::ostringstream &ss, const char *key, const T &value)
 Format a single key-value pair.
 
void format_kvs (std::ostringstream &)
 Format key-value pairs (base case).
 
template<typename V , typename... Args>
void format_kvs (std::ostringstream &ss, const char *key, const V &value, Args &&... args)
 Format key-value pairs (recursive case).
 
template<typename... Args>
void log (Level level, const char *file, int line, const char *message, Args &&... args)
 Core logging function.
 

Enumeration Type Documentation

◆ Level

enum class vanedb::logging::Level
strong

Log level enumeration.

Enumerator
TRACE 
DEBUG 
INFO 
WARN 
ERROR 
OFF 

Definition at line 35 of file logging.h.

Function Documentation

◆ format_kv()

template<typename T >
void vanedb::logging::format_kv ( std::ostringstream &  ss,
const char *  key,
const T &  value 
)
inline

Format a single key-value pair.

Definition at line 103 of file logging.h.

Referenced by format_kvs().

◆ format_kvs() [1/2]

void vanedb::logging::format_kvs ( std::ostringstream &  )
inline

Format key-value pairs (base case).

Definition at line 110 of file logging.h.

Referenced by format_kvs(), and log().

◆ format_kvs() [2/2]

template<typename V , typename... Args>
void vanedb::logging::format_kvs ( std::ostringstream &  ss,
const char *  key,
const V &  value,
Args &&...  args 
)
inline

Format key-value pairs (recursive case).

Definition at line 116 of file logging.h.

References format_kv(), and format_kvs().

◆ get_level()

Level vanedb::logging::get_level ( )
inline

Get the global log level.

Definition at line 87 of file logging.h.

References global_level().

◆ global_level()

Level & vanedb::logging::global_level ( )
inline

Global log level (can be changed at runtime).

Definition at line 61 of file logging.h.

References DEBUG, ERROR, INFO, TRACE, and WARN.

Referenced by get_level(), log(), and set_level().

◆ level_to_string()

const char * vanedb::logging::level_to_string ( Level  level)
inline

Convert log level to string.

Definition at line 47 of file logging.h.

References DEBUG, ERROR, INFO, TRACE, and WARN.

Referenced by log().

◆ log()

template<typename... Args>
void vanedb::logging::log ( Level  level,
const char *  file,
int  line,
const char *  message,
Args &&...  args 
)
inline

Core logging function.

Definition at line 125 of file logging.h.

References format_kvs(), global_level(), level_to_string(), and log_mutex().

◆ log_mutex()

std::mutex & vanedb::logging::log_mutex ( )
inline

Mutex for thread-safe logging.

Definition at line 94 of file logging.h.

Referenced by log().

◆ set_level()

void vanedb::logging::set_level ( Level  level)
inline

Set the global log level.

Definition at line 80 of file logging.h.

References global_level().