Log.h revision 10447
1#ifndef __LOG_H__
2#define __LOG_H__
3
4#include <cstdio>
5#include <iostream>
6#include <fstream>
7
8#include "String.h"
9
10#ifndef LIBUTIL_IS_LOG
11#define LIBUTIL_IS_LOG false
12#endif
13
14namespace LibUtil
15{
16    using std::cerr;
17
18    class Log
19    {
20        public:
21            static void allocate(const String& log_file_name_);
22            static void release();
23
24            static void print(const String& str_);
25            static void print(std::ostream& stream_, const String& str_);
26            static void printLine(const String& str_);
27            static void printLine(std::ostream& stream_, const String& str_);
28
29        protected:
30            static Log* msSingleton;
31            static const bool msIsLog;
32
33        protected:
34            Log(const String& log_file_name_);
35            ~Log();
36
37        protected:
38            std::ofstream ofs;
39    };
40}
41
42#endif // __LOG_H__
43
44