Input/Output utility static class.
More...
#include <Logger.hpp>
|
enum class | Type : char { Info
, Warning
, Error
, Debug
} |
| Enumeration used when logging.
|
|
|
static std::string | logTypeToString (Type type) |
| Convert logging type enumerator to string (used for printing).
|
|
static std::string | format (std::string_view str, const std::vector< Printable > &_args) |
| String formatting utility method, similar to std::format.
|
|
template<typename... Args> |
static std::string | format (std::string_view str, Args... args) |
| String formatting utility method, similar to std::format.
|
|
static void | println () |
| Print single new-line character.
|
|
template<typename... Args> |
static void | print (std::string_view str, Args... args) |
| Format a string and print it to stdout.
|
|
static std::string | read (std::string_view prompt="") |
| Read string from stdin until return key entered.
|
|
template<typename... Args> |
static void | append (std::string &output_string, const std::string &str, Args... args) |
| Format a string and append it to the output string.
|
|
template<typename... Args> |
static void | println (const std::string &str, Args... args) |
| Format a string, append new-line, then print it to stdout.
|
|
template<typename... Args> |
static void | println () |
| Prints a new-line character to stdout.
|
|
template<typename... Args> |
static void | log (Type type, const std::string &str, Args... args) |
| Log a formatted message to stdout, according to its type.
|
|
Input/Output utility static class.
◆ append()
template<typename... Args>
static void linc::Logger::append |
( |
std::string & | output_string, |
|
|
const std::string & | str, |
|
|
Args... | args ) |
|
inlinestatic |
Format a string and append it to the output string.
- Parameters
-
output_string | The output string. |
str | The string to be formatted. |
...args | The variadic argument list to format with. |
◆ format() [1/2]
template<typename... Args>
static std::string linc::Logger::format |
( |
std::string_view | str, |
|
|
Args... | args ) |
|
inlinestatic |
String formatting utility method, similar to std::format.
- Parameters
-
str | The string to be formatted. |
...args | The variadic argument list to format with. |
- Returns
- The resulting string.
◆ format() [2/2]
std::string linc::Logger::format |
( |
std::string_view | str, |
|
|
const std::vector< Printable > & | _args ) |
|
static |
String formatting utility method, similar to std::format.
- Parameters
-
str | The string to be formatted. |
args | The list of arguments to format with. |
- Returns
- The resulting string.
◆ log()
template<typename... Args>
static void linc::Logger::log |
( |
Type | type, |
|
|
const std::string & | str, |
|
|
Args... | args ) |
|
inlinestatic |
Log a formatted message to stdout, according to its type.
- Parameters
-
type | The type of message to log (e.g. warning, error). |
str | The string to be formatted. |
...args | The variadic argument list to format with. |
◆ logTypeToString()
std::string linc::Logger::logTypeToString |
( |
Type | type | ) |
|
|
static |
Convert logging type enumerator to string (used for printing).
- Parameters
-
type | The enumerator to convert. |
- Returns
- The resulting string.
◆ print()
template<typename... Args>
static void linc::Logger::print |
( |
std::string_view | str, |
|
|
Args... | args ) |
|
inlinestatic |
Format a string and print it to stdout.
- Parameters
-
str | The string to be formatted. |
...args | The variadic argument list to format with. |
◆ println() [1/2]
template<typename... Args>
static void linc::Logger::println |
( |
| ) |
|
|
inlinestatic |
Prints a new-line character to stdout.
- Template Parameters
-
...Args | Placeholder template argument (required for function overload). |
◆ println() [2/2]
template<typename... Args>
static void linc::Logger::println |
( |
const std::string & | str, |
|
|
Args... | args ) |
|
inlinestatic |
Format a string, append new-line, then print it to stdout.
- Parameters
-
str | The string to be formatted. |
...args | The variadic argument list to format with. |
◆ read()
std::string linc::Logger::read |
( |
std::string_view | prompt = "" | ) |
|
|
static |
Read string from stdin until return key entered.
- Returns
- The resulting string, as read from stdin.
The documentation for this class was generated from the following files: