#ifndef BLUECORE_LOG_H #define BLUECORE_LOG_H #include #include 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 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