mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
simplify logger for shorter calls and readability
This commit is contained in:
@@ -8,32 +8,34 @@
|
||||
#ifndef FAIRMQLOGGER_H_
|
||||
#define FAIRMQLOGGER_H_
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <sys/time.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <ctime>
|
||||
|
||||
using std::string;
|
||||
using std::stringstream;
|
||||
#include "FairMQLogger.h"
|
||||
|
||||
using std::ostringstream;
|
||||
|
||||
class FairMQLogger
|
||||
{
|
||||
private:
|
||||
static FairMQLogger* instance;
|
||||
string fBindAddress;
|
||||
public:
|
||||
enum {
|
||||
DEBUG, INFO, ERROR, STATE
|
||||
};
|
||||
FairMQLogger();
|
||||
FairMQLogger(const string& bindAdress);
|
||||
virtual ~FairMQLogger();
|
||||
void Log(int type, const string& logmsg);
|
||||
static FairMQLogger* GetInstance();
|
||||
static FairMQLogger* InitInstance(const string& bindAddress);
|
||||
ostringstream& Log(int type);
|
||||
private:
|
||||
ostringstream os;
|
||||
};
|
||||
|
||||
typedef unsigned long long timestamp_t;
|
||||
|
||||
timestamp_t get_timestamp ();
|
||||
|
||||
#define LOG(type) \
|
||||
FairMQLogger::FairMQLogger().Log(FairMQLogger::type)
|
||||
|
||||
#endif /* FAIRMQLOGGER_H_ */
|
||||
|
Reference in New Issue
Block a user