Fixed minor issues

- Fixed error message formatting
- Fixed setting verbosity levels
- Fixed implementation of `replace_first` and `replace_all`
- Fixed issue where installing a package would failed because of unescaped single quotes in SQL statement
- Fixed error code returned from SQLITE related errors
- Fixed verbose flag not being repeatable and set correctly
- Fixed some error messages to correctly reflect occuring error
- Fixed the prompt asking the user twice and not taking a default input
- Added functions to get logging default prefixes
- Added `version` command (not implemented yet)
This commit is contained in:
David Allen 2023-06-18 21:10:50 -06:00
parent 02a4e879a8
commit c88cb08e03
9 changed files with 126 additions and 121 deletions

View file

@ -93,18 +93,17 @@ namespace gdpm{
namespace log {
static constexpr void error(const gdpm::error& e){
#if GDPM_LOG_LEVEL > ERROR
set_prefix_if(std::format("[ERROR {}] ", utils::timestamp()), true);
set_suffix_if("\n");
vlog(
fmt::format(GDPM_COLOR_LOG_ERROR "[ERROR {}] {}\n" GDPM_COLOR_LOG_RESET, utils::timestamp(), e.get_message()),
fmt::make_format_args("" /*e.get_message()*/)
fmt::format(GDPM_COLOR_LOG_ERROR "{}{}\n" GDPM_COLOR_LOG_RESET, prefix.contents, e.get_message()),
fmt::make_format_args(prefix.contents, e.get_message())
);
#endif
}
template <typename S, typename...Args>
static constexpr void error(const S& prefix, const gdpm::error& e){
vlog(
fmt::format(GDPM_COLOR_LOG_ERROR + prefix + GDPM_COLOR_LOG_RESET, e.get_message())
);
static void error(const char *p, const gdpm::error& e){
println("{}{}{}", p, prefix.contents, e.get_message());
}
}
}