hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RealLoggable.hpp
Go to the documentation of this file.
1 
14 #ifndef REAL_LOGGABLE_HPP
15 #define REAL_LOGGABLE_HPP
16 
17 #include <time.h>
18 
19 #include "LoggerStream.hpp"
20 
21 namespace HCE
22 {
23 namespace tests
24 {
25 //-----------------------------------------------------------------------------
26 class RealLoggable : public Loggable
27 {
28 public:
29  virtual ~RealLoggable(void) {}
30 
31  virtual std::string operator()(const std::string& data)
32  {
33  std::ostringstream ostr;
34  time_t rawtime;
35  struct tm * timeinfo;
36  char buffer [80]={0};
37 
38  time(&rawtime);
39  timeinfo = localtime(&rawtime);
40  strftime (buffer, 80, "%F %b %a %X : ", timeinfo);
41 
42  ostr << buffer << data;
43  return ostr.str();
44  }
45 };
46 //-----------------------------------------------------------------------------
47 //-----------------------------------------------------------------------------
48 } // end namespace tests
49 } // end namespace HCE
50 
51 
52 
53 #endif // REAL_LOGGABLE_HPP