mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-25 23:06:10 -05:00
Merge pull request #1846 from G10h4ck/millisec_dbg_message
Add millisecond details to debug messages timestamp
This commit is contained in:
commit
b51520bccf
@ -75,7 +75,8 @@ private:
|
|||||||
#else // def __ANDROID__
|
#else // def __ANDROID__
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <ctime>
|
#include <chrono>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
enum class RsLoggerCategories
|
enum class RsLoggerCategories
|
||||||
{
|
{
|
||||||
@ -96,8 +97,15 @@ struct t_RsLogger
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline stream_type& operator<<(const T& val)
|
inline stream_type& operator<<(const T& val)
|
||||||
{
|
{
|
||||||
return std::cerr << static_cast<char>(CATEGORY) << " " << time(nullptr)
|
using namespace std::chrono;
|
||||||
<< " " << val;
|
const auto now = system_clock::now();
|
||||||
|
const auto sec = time_point_cast<seconds>(now);
|
||||||
|
const auto msec = duration_cast<milliseconds>(now - sec);
|
||||||
|
const auto tFill = std::cerr.fill();
|
||||||
|
return std::cerr << static_cast<char>(CATEGORY) << " "
|
||||||
|
<< sec.time_since_epoch().count() << "."
|
||||||
|
<< std::setfill('0') << std::setw(3) << msec.count()
|
||||||
|
<< std::setfill(tFill) << " " << val;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif // def __ANDROID__
|
#endif // def __ANDROID__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user