FairMQ/fairmq/FairMQLogger.h
2013-06-07 08:07:48 +00:00

46 lines
859 B
C++

/*
* FairMQLogger.h
*
* Created on: Dec 4, 2012
* Author: dklein
*/
#ifndef FAIRMQLOGGER_H_
#define FAIRMQLOGGER_H_
#include <string>
#include <sstream>
//#ifndef _MAKECINT_
#include <sys/time.h>
//#endif
#include "Rtypes.h"
#include "TString.h"
class FairMQLogger
{
private:
static FairMQLogger* instance;
TString fBindAddress;
public:
enum {
DEBUG, INFO, ERROR
};
FairMQLogger();
FairMQLogger(TString bindAdress);
virtual ~FairMQLogger();
void Log(Int_t type, TString logmsg);
static FairMQLogger* GetInstance();
static FairMQLogger* InitInstance(TString bindAddress);
};
typedef unsigned long long timestamp_t;
static timestamp_t get_timestamp ()
{
struct timeval now;
gettimeofday (&now, NULL);
return now.tv_usec + (timestamp_t)now.tv_sec * 1000000;
}
#endif /* FAIRMQLOGGER_H_ */