Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <vector>
- using namespace std;
- // Note: Need to do in FP (-_-)
- // AM guerrilla logger
- std::vector<std::wstring> amLogs;
- template<typename... TObj>
- void amLogFn(std::string aFunction, int aLine, TObj... aArgs) {
- std::wstring fn(aFunction.begin(), aFunction.end());
- std::wstringstream ss;
- ss << fn << L"[" << aLine << L"]: ";
- for (const auto obj : {aArgs...}) {
- ss << obj;
- }
- ss << endl;
- amLogs.push_back(ss.str());
- }
- std::wstring amPrintFn() {
- std::wstringstream ss;
- for(const auto& s : amLogs) {
- ss << s;
- }
- return ss.str();
- }
- #define AMLOG(...) amLogFn(__FUNCTION__, __LINE__, __VA_ARGS__, L"AMTERM")
- #define AMPRINT amPrintFn()
- int main()
- {
- AMLOG(L"Hi ", L"Test");
- AMLOG(L"Hi", L"Test", 213);
- const auto s = AMPRINT;
- std::wcout << s;
- }
- // GCC reference:
- // https://gcc.gnu.org/
- // C++ language references:
- // https://cppreference.com/
- // https://isocpp.org/
- // http://www.open-std.org/jtc1/sc22/wg21/
- // Boost libraries references:
- // https://www.boost.org/doc/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement