00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
#ifndef __LOG__
00019
#define __LOG__
00020
00021 #define WARNING(msg) "\e[33;1mWARNING\e[0m: " msg
00022 #define MESSAGE(msg) "\e[32;1mMESSAGE\e[0m: " msg
00023 #define ERROR(msg) "\e[31;1mERROR \e[0m: " msg
00024
00025
#include <cc++/thread.h>
00026
#include <ptf/environment/clock.hpp>
00027
#include <string>
00028
#include <sstream>
00029
00030
using ost::Mutex;
00031
using std::stringstream;
00032
using std::string;
00033
00037 class Log {
00038
public:
00039
Log();
00040
Log(
bool);
00041
~Log();
00042
bool getSilent();
00043
void setSilent(
bool);
00044
Log&
operator<<(
const string&);
00045
Log&
operator<<(
const char*);
00046
Log&
operator<<(
const int&);
00047
Log&
operator<<(
const float&);
00048
Log&
operator<<(
const double&);
00049
Log&
operator<<(
const timespec&);
00050
void saveToFile(
const char*);
00051
protected:
00052 Mutex
mutex;
00053 stringstream
sstream;
00054 bool silent;
00055 };
00056
00057
#endif