bluecore/engine/Utilities/Log.h

61 lines
958 B
C
Raw Normal View History

2008-01-16 12:45:17 +01:00
#ifndef BLUECORE_LOG_H
#define BLUECORE_LOG_H
#include <iostream>
#include <fstream>
namespace BlueCore
{
class Log
{
std::string _LogFilename;
std::ofstream _LogFile;
public:
class EndLine
{
};
class EndLog
{
};
class Time
{
};
class Flush
{
};
Log();
void setFilename( const std::string &name );
void reset();
template<class T>
Log &operator << (const T &v)
{
if( !_LogFile.is_open() )
_LogFile.open(_LogFilename.c_str(), std::ios::app);
_LogFile << v;
std::cout << v;
return *this;
}
Log &operator << (const EndLine &e);
Log &operator << (const EndLog &e);
Log &operator << (const Time &t);
Log &operator << (const Flush &f);
};
extern Log::EndLine endline;
extern Log::EndLog endlog;
extern Log::Time time;
extern Log::Flush flush;
extern Log clog;
} // namespace bc
#endif // BLUECORE_LOG_H