-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from Klebert-Engineering/feature/spdlog
Extended Logging
- Loading branch information
Showing
13 changed files
with
320 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#pragma once | ||
|
||
#include "spdlog/spdlog.h" | ||
|
||
namespace httpcl | ||
{ | ||
|
||
/** | ||
* Obtain global logger, which is initialized from | ||
* the following environment variables: | ||
* - HTTP_LOG_LEVEL | ||
* - HTTP_LOG_FILE | ||
* - HTTP_LOG_FILE_MAXSIZE | ||
*/ | ||
spdlog::logger& log(); | ||
|
||
/** | ||
* Log a runtime error and return the throwable object. | ||
* @param what Runtime error message. | ||
* @return std::runtime_error to throw. | ||
*/ | ||
template<typename error_t = std::runtime_error> | ||
error_t logRuntimeError(std::string const& what) { | ||
log().error(what); | ||
return error_t(what); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.