-
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 branch 'ESK-develop' of https://github.com/decenomy/DSW
- Loading branch information
Showing
22 changed files
with
1,655 additions
and
114 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
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,34 @@ | ||
#ifndef BITCOIN_LOGGING_H | ||
#define BITCOIN_LOGGING_H | ||
|
||
#include "tinyformat.h" | ||
#include <cerrno> // For perror | ||
#include <cstring> // For strerror | ||
#include <iostream> | ||
#include <string> | ||
|
||
/** Get format string from VA_ARGS for error reporting */ | ||
template<typename... Args> std::string FormatStringFromLogArgs(const char *fmt, const Args&... args) { return fmt; } | ||
|
||
#define LogPrintf(...) do { \ | ||
if(true) { \ | ||
std::string _log_msg_; /* Unlikely name to avoid shadowing variables */ \ | ||
try { \ | ||
_log_msg_ = tfm::format(__VA_ARGS__); \ | ||
} catch (tinyformat::format_error &e) { \ | ||
/* Original format string will have newline so don't add one here */ \ | ||
_log_msg_ = "Error \"" + std::string(e.what()) + \ | ||
"\" while formatting log message: " + \ | ||
FormatStringFromLogArgs(__VA_ARGS__); \ | ||
} \ | ||
std::cout << _log_msg_; \ | ||
} \ | ||
} while(0) | ||
|
||
#define LogPrint(category, ...) do { \ | ||
if (LogAcceptCategory((category))) { \ | ||
LogPrintf(__VA_ARGS__); \ | ||
} \ | ||
} while(0) | ||
|
||
#endif |
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
Oops, something went wrong.