Logging header: Wide string support on linux is at best flaky, so only Windows version gets both string and wide string support. Linux gets only regular string support.
More...
#include <format>
#include <source_location>
#include <sstream>
#include <string_view>
#include "Common.hpp"
Go to the source code of this file.
|
|
#define | PWN_COLOR_RESET "" |
| |
|
#define | PWN_COLOR_BOLD "" |
| |
|
#define | PWN_COLOR_UNDERLINE "" |
| |
|
#define | PWN_COLOR_FG_BLACK "" |
| |
|
#define | PWN_COLOR_FG_RED "" |
| |
|
#define | PWN_COLOR_FG_GREEN "" |
| |
|
#define | PWN_COLOR_FG_YELLOW "" |
| |
|
#define | PWN_COLOR_FG_BLUE "" |
| |
|
#define | PWN_COLOR_FG_MAGENTA "" |
| |
|
#define | PWN_COLOR_FG_CYAN "" |
| |
|
#define | PWN_COLOR_FG_WHITE "" |
| |
|
#define | PWN_LOG_STRINGS_DEBUG "[ DEBUG ] " |
| |
|
#define | PWN_LOG_STRINGS_INFO "[ INFO ] " |
| |
|
#define | PWN_LOG_STRINGS_SUCCESS "[ SUCCESS ] " |
| |
|
#define | PWN_LOG_STRINGS_WARN "[ WARN ] " |
| |
|
#define | PWN_LOG_STRINGS_ERROR "[ ERROR ] " |
| |
|
#define | PWN_LOG_STRINGS_CRITICAL "[ CRITICAL ] " |
| |
| #define | dbg(...) Log::Log(Log::LogLevel::Debug, std::source_location::current(), ##__VA_ARGS__) |
| |
|
#define | info(...) Log::Log(Log::LogLevel::Info, std::source_location::current(), ##__VA_ARGS__) |
| |
|
#define | ok(...) Log::Log(Log::LogLevel::Success, std::source_location::current(), ##__VA_ARGS__) |
| |
|
#define | warn(...) Log::Log(Log::LogLevel::Warning, std::source_location::current(), ##__VA_ARGS__) |
| |
|
#define | err(...) Log::Log(Log::LogLevel::Error, std::source_location::current(), ##__VA_ARGS__) |
| |
|
| void | pwn::Log::Log (const LogLevel level, std::source_location const &location, std::ostringstream &msg) |
| | Print an output string stream as a log message. More...
|
| |
| template<typename... Args> |
| void | pwn::Log::Log (const LogLevel level, std::source_location const &location, std::string_view const &fmt, Args &&... args) |
| | Generic logging function with prefix and arguments, for strings Note: prefer using the macros dbg, info, ok, warn and err More...
|
| |
| void | pwn::Log::Log (const LogLevel level, std::source_location const &location, std::wostringstream &msg) |
| |
| template<typename... Args> |
| void | pwn::Log::Log (const LogLevel level, std::source_location const &location, std::wstring_view const &fmt, Args &&... args) |
| | Generic logging function with prefix and arguments, for wide strings Note: prefer using the macros dbg, info, ok, warn and err More...
|
| |
Logging header: Wide string support on linux is at best flaky, so only Windows version gets both string and wide string support. Linux gets only regular string support.
- Copyright
- Copyright (c) 2022
◆ dbg
| #define dbg |
( |
|
... | ) |
Log::Log(Log::LogLevel::Debug, std::source_location::current(), ##__VA_ARGS__) |
Convenience logging macros
◆ LogLevel
Define the logging level.
| Enumerator |
|---|
| Debug | Debug logging level
|
| Info | Info logging level
|
| Success | Success logging level
|
| Warning | Warning logging level
|
| Error | Error logging level
|
| Critical | Critical logging level
|
◆ Log() [1/4]
| void pwn::Log::Log |
( |
const LogLevel |
level, |
|
|
std::source_location const & |
location, |
|
|
std::ostringstream & |
msg |
|
) |
| |
Print an output string stream as a log message.
- Parameters
-
◆ Log() [2/4]
template<typename... Args>
| void pwn::Log::Log |
( |
const LogLevel |
level, |
|
|
std::source_location const & |
location, |
|
|
std::string_view const & |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
Generic logging function with prefix and arguments, for strings Note: prefer using the macros dbg, info, ok, warn and err
- Parameters
-
| [in] | level | |
| [in] | location | |
| [in] | fmt | |
| [in] | args | |
◆ Log() [3/4]
| void pwn::Log::Log |
( |
const LogLevel |
level, |
|
|
std::source_location const & |
location, |
|
|
std::wostringstream & |
msg |
|
) |
| |
◆ Log() [4/4]
template<typename... Args>
| void pwn::Log::Log |
( |
const LogLevel |
level, |
|
|
std::source_location const & |
location, |
|
|
std::wstring_view const & |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
Generic logging function with prefix and arguments, for wide strings Note: prefer using the macros dbg, info, ok, warn and err
- Parameters
-
| [in] | level | |
| [in] | location | |
| [in] | fmt | |
| [in] | args | |