summaryrefslogtreecommitdiff
path: root/ext/dsent/libutil/Log.h
blob: 9c759e702a5b4b9679dca6400e8b408d569928bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef __LOG_H__
#define __LOG_H__

#include <cstdio>
#include <iostream>
#include <fstream>

#include "String.h"

#ifndef LIBUTIL_IS_LOG
#define LIBUTIL_IS_LOG false
#endif

namespace LibUtil
{
    using std::cerr;

    class Log
    {
        public:
            static void allocate(const String& log_file_name_);
            static void release();

            static void print(const String& str_);
            static void print(std::ostream& stream_, const String& str_);
            static void printLine(const String& str_);
            static void printLine(std::ostream& stream_, const String& str_);

        protected:
            static Log* msSingleton;
            static const bool msIsLog;

        protected:
            Log(const String& log_file_name_);
            ~Log();

        protected:
            std::ofstream ofs;
    };
}

#endif // __LOG_H__