mirror of
https://github.com/davidallendj/gdpm.git
synced 2025-12-20 03:27:02 -07:00
More refactoring and bug fixes
- Added `libhttp` and `librest_api` targets to CMakeLists.txt - Added examples for `libhttp` and `librest_api` in examples directory - Added `cache` and `add` commands - Added documentation for `libhttp` and `librest_api` - Added all available HTTP response codes to REST API - Changed how `bin/compile.sh` works (must supply args to build)
This commit is contained in:
parent
5a73651ad1
commit
8b1f1374d8
23 changed files with 575 additions and 164 deletions
|
|
@ -78,9 +78,7 @@ namespace gdpm{
|
|||
string get_message() const { return m_message; }
|
||||
bool has_occurred() const { return m_code != 0; }
|
||||
|
||||
bool operator()(){
|
||||
return has_occurred();
|
||||
}
|
||||
bool operator()(){ return has_occurred(); }
|
||||
|
||||
private:
|
||||
int m_code;
|
||||
|
|
@ -89,14 +87,20 @@ namespace gdpm{
|
|||
|
||||
// Add logging function that can handle error objects
|
||||
namespace log {
|
||||
template <typename S, typename...Args>
|
||||
static constexpr void error(const gdpm::error& e){
|
||||
#if GDPM_LOG_LEVEL > 1
|
||||
#if GDPM_LOG_LEVEL > ERROR
|
||||
vlog(
|
||||
fmt::format(GDPM_COLOR_LOG_ERROR "[ERROR {}" GDPM_COLOR_LOG_RESET, e.get_message()),
|
||||
fmt::format(GDPM_COLOR_LOG_ERROR "[ERROR {}] {}\n" GDPM_COLOR_LOG_RESET, utils::timestamp(), e.get_message()),
|
||||
fmt::make_format_args("" /*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())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue