Logger: fixed the case when the first << operand is a manipulator

log << std::dec << 123; failed before.  Simplified the whole Logger class,
removed add() functions nobody wants to use anyways.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1097 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hsc
2012-04-18 12:36:41 +00:00
parent 0963a06209
commit 1027b9faf2
2 changed files with 11 additions and 24 deletions

View File

@ -17,6 +17,8 @@ class Logger
std::ostream* m_pDest;
std::string m_description;
bool m_showTime;
void timestamp();
public:
/**
* Constructor.
@ -38,29 +40,15 @@ class Logger
m_description = descr;
}
/**
* Add a new log entry.
* @param what Message for log entry.
* @param descr Description shown alongside this log entry in square
* brackets [ ].
*/
void add(const std::string& what, const std::string& descr);
/**
* Add a new log entry.
* @param what Message for log entry. The default description is
* being used in square brackets [ ].
*/
void add(const std::string& what) { add(what, m_description); }
/**
* Simplifies the logging.
* Add a new log entry. Returns a std::ostream reference to continue
* streaming a longer log entry.
* @param v data to log
*/
template<class T>
inline std::ostream& operator <<(const T& v)
{
std::stringstream ss;
ss << v;
add(ss.str());
return (*m_pDest);
timestamp();
return (*m_pDest) << v;
}
};