oak - a modern logger 1.0
Loading...
Searching...
No Matches
oak.hpp File Reference
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <ctime>
#include <deque>
#include <expected>
#include <filesystem>
#include <format>
#include <fstream>
#include <future>
#include <iomanip>
#include <iostream>
#include <ostream>
#include <string>
#include <thread>
#include <unistd.h>

Go to the source code of this file.

Data Structures

struct  oak::queue_element
 
struct  oak::logger
 
struct  std::formatter< oak::level >
 
struct  std::formatter< oak::flags >
 

Namespaces

namespace  oak
 

Macros

#define OAK_DEBUG(...)   oak::log(oak::level::debug, __VA_ARGS__)
 
#define OAK_INFO(...)   oak::log(oak::level::info, __VA_ARGS__)
 
#define OAK_WARN(...)   oak::log(oak::level::warn, __VA_ARGS__)
 
#define OAK_ERROR(...)   oak::log(oak::level::error, __VA_ARGS__)
 
#define OAK_OUTPUT(...)   oak::log(oak::level::output, __VA_ARGS__)
 

Enumerations

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

Functions

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

Macro Definition Documentation

◆ OAK_DEBUG

#define OAK_DEBUG ( ...)    oak::log(oak::level::debug, __VA_ARGS__)

Definition at line 60 of file oak.hpp.

◆ OAK_ERROR

#define OAK_ERROR ( ...)    oak::log(oak::level::error, __VA_ARGS__)

Definition at line 63 of file oak.hpp.

◆ OAK_INFO

#define OAK_INFO ( ...)    oak::log(oak::level::info, __VA_ARGS__)

Definition at line 61 of file oak.hpp.

◆ OAK_OUTPUT

#define OAK_OUTPUT ( ...)    oak::log(oak::level::output, __VA_ARGS__)

Definition at line 64 of file oak.hpp.

◆ OAK_WARN

#define OAK_WARN ( ...)    oak::log(oak::level::warn, __VA_ARGS__)

Definition at line 62 of file oak.hpp.