Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00030 #ifndef __CLAW_LOG_STREAM_HPP__
00031 #define __CLAW_LOG_STREAM_HPP__
00032
00033 #include <string>
00034 #include <fstream>
00035 #include <claw/non_copyable.hpp>
00036
00037 #ifndef CLAW_LOGGER_EXPORT
00038 # ifdef CLAW_LOGGER_NO_EXPORT
00039 # define CLAW_LOGGER_EXPORT
00040 # else
00041 # ifdef _WIN32
00042 # ifdef claw_logger_EXPORTS
00043 # define CLAW_LOGGER_EXPORT __declspec(dllexport)
00044 # else
00045 # define CLAW_LOGGER_EXPORT __declspec(dllimport)
00046 # endif // def claw_logger_EXPORTS
00047 # else // def _WIN32
00048 # define CLAW_LOGGER_EXPORT
00049 # endif // def _WIN32
00050 # endif // def CLAW_LOGGER_NO_EXPORT
00051 #endif // ndef CLAW_LOGGER_EXPORT
00052
00053 namespace claw
00054 {
00059 class CLAW_LOGGER_EXPORT log_stream
00060 {
00061 public:
00062 virtual ~log_stream();
00063 virtual void write( const std::string& str ) = 0;
00064 virtual void flush();
00065 };
00066
00071 class CLAW_LOGGER_EXPORT console_logger
00072 : public log_stream,
00073 public pattern::non_copyable
00074 {
00075 public:
00076 virtual void write( const std::string& str );
00077 virtual void flush();
00078 };
00079
00084 class CLAW_LOGGER_EXPORT file_logger
00085 : public log_stream,
00086 public pattern::non_copyable
00087 {
00088 public:
00089 file_logger( const std::string& filename );
00090 virtual ~file_logger();
00091
00092 virtual void write( const std::string& str );
00093 virtual void flush();
00094
00095 private:
00097 std::ofstream* m_file;
00098
00099 };
00100 }
00101
00102 #endif // __CLAW_LOG_STREAM_HPP__