oak - a modern logger 1.0
Loading...
Searching...
No Matches
oak Namespace Reference

Data Structures

struct  logger
 
struct  queue_element
 

Enumerations

enum class  level {
  debug = 0 , info , warn , error ,
  output , disabled , _max_level
}
 
enum class  protocol_t { tcp = 0 , udp , _max_protocol }
 
enum class  flags {
  none = 0 , level = 1 , date = 2 , time = 4 ,
  pid = 8 , tid = 16 , json = 32
}
 
enum class  destination { std_out = 0 , file , socket , _max_destination }
 

Functions

level get_level ()
 
long unsigned int get_flags ()
 
bool is_file_open ()
 
void set_level (const oak::level &lvl)
 
std::expected< int, std::string > set_file (const std::string &file)
 
void close_file ()
 
void add_to_queue (const std::string &str, const destination &d)
 
template<typename... Args>
void add_flags (flags flg, Args &&...args)
 
template<typename... Args>
void add_flags (flags flg)
 
template<typename... Args>
void set_flags (flags flg, Args &&...args)
 
void writer ()
 
void init_writer ()
 
void stop_writer ()
 
std::expected< int, std::string > settings_file (const std::string &file)
 
template<typename... Args>
std::string constexpr log_to_string (const level &lvl, const std::string &fmt, Args &&...args)
 
template<typename... Args>
void log_to_stdout (const level &lvl, const std::string &fmt, Args &&...args)
 
void log_to_stdout (const std::string &str)
 
template<typename... Args>
void log_to_file (const level &lvl, const std::string &fmt, Args &&...args)
 
void log_to_file (const std::string &str)
 
template<typename... Args>
void log (const level &lvl, const std::string &fmt, Args &&...args)
 
template<typename... Args>
void out (const std::string &fmt, Args &&...args)
 
template<typename... Args>
void debug (const std::string &fmt, Args &&...args)
 
template<typename... Args>
void info (const std::string &fmt, Args &&...args)
 
template<typename... Args>
void warn (const std::string &fmt, Args &&...args)
 
template<typename... Args>
void error (const std::string &fmt, Args &&...args)
 
template<typename... Args>
void output (const std::string &fmt, Args &&...args)
 
template<typename... Args>
void async (const level &lvl, const std::string &fmt, Args &&...args)
 
void flush ()
 

Enumeration Type Documentation

◆ destination

enum class oak::destination
strong
Enumerator
std_out 
file 
socket 
_max_destination 

Definition at line 98 of file oak.hpp.

◆ flags

enum class oak::flags
strong
Enumerator
none 
level 
date 
time 
pid 
tid 
json 

Definition at line 87 of file oak.hpp.

◆ level

enum class oak::level
strong
Enumerator
debug 
info 
warn 
error 
output 
disabled 
_max_level 

Definition at line 69 of file oak.hpp.

◆ protocol_t

enum class oak::protocol_t
strong
Enumerator
tcp 
udp 
_max_protocol 

Definition at line 80 of file oak.hpp.

Function Documentation

◆ add_flags() [1/2]

template<typename... Args>
void oak::add_flags ( flags flg)

Definition at line 178 of file oak.hpp.

◆ add_flags() [2/2]

template<typename... Args>
void oak::add_flags ( flags flg,
Args &&... args )

Definition at line 165 of file oak.hpp.

◆ add_to_queue()

void oak::add_to_queue ( const std::string & str,
const destination & d )

◆ async()

template<typename... Args>
void oak::async ( const level & lvl,
const std::string & fmt,
Args &&... args )
inline

Definition at line 390 of file oak.hpp.

◆ close_file()

void oak::close_file ( )

◆ debug()

template<typename... Args>
void oak::debug ( const std::string & fmt,
Args &&... args )
inline

Definition at line 360 of file oak.hpp.

◆ error()

template<typename... Args>
void oak::error ( const std::string & fmt,
Args &&... args )
inline

Definition at line 378 of file oak.hpp.

◆ flush()

void oak::flush ( )

◆ get_flags()

long unsigned int oak::get_flags ( )
inline

Definition at line 137 of file oak.hpp.

◆ get_level()

level oak::get_level ( )
inline

Definition at line 131 of file oak.hpp.

◆ info()

template<typename... Args>
void oak::info ( const std::string & fmt,
Args &&... args )
inline

Definition at line 366 of file oak.hpp.

◆ init_writer()

void oak::init_writer ( )

◆ is_file_open()

bool oak::is_file_open ( )
inline

Definition at line 143 of file oak.hpp.

◆ log()

template<typename... Args>
void oak::log ( const level & lvl,
const std::string & fmt,
Args &&... args )

Definition at line 328 of file oak.hpp.

◆ log_to_file() [1/2]

template<typename... Args>
void oak::log_to_file ( const level & lvl,
const std::string & fmt,
Args &&... args )

Definition at line 304 of file oak.hpp.

◆ log_to_file() [2/2]

void oak::log_to_file ( const std::string & str)

◆ log_to_stdout() [1/2]

template<typename... Args>
void oak::log_to_stdout ( const level & lvl,
const std::string & fmt,
Args &&... args )

Definition at line 290 of file oak.hpp.

◆ log_to_stdout() [2/2]

void oak::log_to_stdout ( const std::string & str)
inline

Definition at line 298 of file oak.hpp.

◆ log_to_string()

template<typename... Args>
std::string constexpr oak::log_to_string ( const level & lvl,
const std::string & fmt,
Args &&... args )
constexpr

Definition at line 203 of file oak.hpp.

◆ out()

template<typename... Args>
void oak::out ( const std::string & fmt,
Args &&... args )
inline

Definition at line 354 of file oak.hpp.

◆ output()

template<typename... Args>
void oak::output ( const std::string & fmt,
Args &&... args )
inline

Definition at line 384 of file oak.hpp.

◆ set_file()

std::expected< int, std::string > oak::set_file ( const std::string & file)

◆ set_flags()

template<typename... Args>
void oak::set_flags ( flags flg,
Args &&... args )

Definition at line 186 of file oak.hpp.

◆ set_level()

void oak::set_level ( const oak::level & lvl)
inline

Definition at line 149 of file oak.hpp.

◆ settings_file()

std::expected< int, std::string > oak::settings_file ( const std::string & file)

◆ stop_writer()

void oak::stop_writer ( )

◆ warn()

template<typename... Args>
void oak::warn ( const std::string & fmt,
Args &&... args )
inline

Definition at line 372 of file oak.hpp.

◆ writer()

void oak::writer ( )