Browse Source

Adding a StructuredLogging stop event

cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
afaac3f511
  1. 1
      eth/main.cpp
  2. 14
      libdevcore/StructuredLogger.cpp
  3. 1
      libdevcore/StructuredLogger.h

1
eth/main.cpp

@ -910,6 +910,7 @@ int main(int argc, char** argv)
while (!g_exit)
this_thread::sleep_for(chrono::milliseconds(1000));
structuredLogger.logStopping(clientImplString, dev::Version);
auto netData = web3.saveNetwork();
if (!netData.empty())
writeFile((dbPath.size() ? dbPath : getDataDir()) + "/network.rlp", netData);

14
libdevcore/StructuredLogger.cpp

@ -66,6 +66,20 @@ void StructuredLogger::logStarting(string const& _clientImpl, const char* _ethVe
}
}
void StructuredLogger::logStopping(string const& _clientImpl, const char* _ethVersion) const
{
if (m_enabled)
{
Json::Value event;
event["comment"] = "last event before termination of the client";
event["client_impl"] = _clientImpl;
event["eth_version"] = std::string(_ethVersion);
event["ts"] = timePointToString(std::chrono::system_clock::now());
outputJson(event, "stopping");
}
}
void StructuredLogger::logP2PConnected(string const& _id, bi::tcp::endpoint const& _addr,
chrono::system_clock::time_point const& _ts, string const& _remoteVersion, unsigned int _numConnections) const
{

1
libdevcore/StructuredLogger.h

@ -51,6 +51,7 @@ public:
m_enabled(_enabled), m_timeFormat(_timeFormat) {}
void logStarting(std::string const& _clientImpl, const char* _ethVersion) const;
void logStopping(std::string const& _clientImpl, const char* _ethVersion) const;
void logP2PConnected(std::string const& _id, bi::tcp::endpoint const& _addr,
std::chrono::system_clock::time_point const& _ts, std::string const& _remoteVersion, unsigned int _numConnections) const;
void logP2PDisconnected(std::string const& _id, bi::tcp::endpoint const& _addr, unsigned int _numConnections) const;

Loading…
Cancel
Save