mirror of
https://github.com/davidallendj/gdpm.git
synced 2025-12-20 03:27:02 -07:00
Change command-line parsing (again...)
- Added formatted table with `--style` option - Added `warning` log level - Fixed bugs and cleaned up API - Removed some extra debugging output
This commit is contained in:
parent
0238dfd510
commit
b36d55ceee
15 changed files with 685 additions and 255 deletions
|
|
@ -77,6 +77,7 @@ namespace gdpm::log
|
|||
inline constexpr const char* get_info_prefix() { return "[INFO {}] "; }
|
||||
inline constexpr const char* get_error_prefix() { return "[ERROR {}] "; }
|
||||
inline constexpr const char* get_debug_prefix() { return "[DEBUG {}] "; }
|
||||
inline constexpr const char* get_warning_prefix() { return "[WARN {}] "; }
|
||||
|
||||
static void vlog(fmt::string_view format, fmt::format_args args){
|
||||
fmt::vprint(format, args);
|
||||
|
|
@ -142,6 +143,21 @@ namespace gdpm::log
|
|||
#endif
|
||||
}
|
||||
|
||||
template <typename S, typename...Args>
|
||||
static constexpr void warn(const S& format, Args&&...args){
|
||||
if(log::level < to_int(log::WARNING))
|
||||
return;
|
||||
#if GDPM_LOG_LEVEL > WARN
|
||||
set_prefix_if(std::format(get_warning_prefix(), utils::timestamp()), true);
|
||||
set_suffix_if("\n");
|
||||
vlog(
|
||||
fmt::format(GDPM_COLOR_LOG_WARNING "{}{}{}" GDPM_COLOR_LOG_RESET, prefix.contents, format, suffix),
|
||||
fmt::make_format_args(args...)
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
template <typename S, typename...Args>
|
||||
static constexpr void print(const S& format, Args&&...args){
|
||||
vlog(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue