*
*/
-#ifndef _LOGSINGLETON_H_
-#define _LOGSINGLETON_H_
+#ifndef SETUP_LOGSINGLETON_H
+#define SETUP_LOGSINGLETON_H
-#include "String++.h"
#include <iostream>
enum log_level {
};
// Logging class. Default logging level is PLAIN.
-class LogSingleton : public ostream
+class LogSingleton : public std::ostream
{
public:
// Singleton support
* which guarantees to flush any log data...
* but doesn't call generic C++ destructors
*/
- __attribute__ ((noreturn)) virtual void exit (int const exit_code) = 0;
+ __attribute__ ((noreturn)) virtual void exit (int, bool = true) = 0;
virtual ~LogSingleton();
// get a specific verbosity stream.
- virtual ostream &operator() (enum log_level level) = 0;
+ virtual std::ostream &operator() (enum log_level level) = 0;
- friend ostream& endLog(ostream& outs);
+ friend std::ostream& endLog(std::ostream& outs);
protected:
- LogSingleton(); // Only child classs can be created.
+ LogSingleton(std::streambuf* aStream); // Only child classs can be created.
LogSingleton (LogSingleton const &); // no copy constructor
LogSingleton &operator = (LogSingleton const&); // no assignment operator
virtual void endEntry() = 0; // the current in-progress entry is complete.
};
/* End of a Log comment */
-extern ostream& endLog(ostream& outs);
-//extern ostream& endLog(ostream& outs);
+extern std::ostream& endLog(std::ostream& outs);
-#define log(X) LogSingleton::GetInstance()(X)
-#endif /* _LOGSINGLETON_H_ */
+#define Log(X) (LogSingleton::GetInstance ()(X))
+
+// Log adapators for printf-style output
+void LogBabblePrintf(const char *fmt, ...);
+void LogPlainPrintf(const char *fmt, ...);
+
+#endif /* SETUP_LOGSINGLETON_H */