cdoDebugOutput.cc 975 Bytes
Newer Older
Oliver Heidmann's avatar
Oliver Heidmann committed
1
2
#include "cdoDebugOutput.h"

3
4
5
6
7
8
9
namespace CdoLog
{
    void StdOut(std::stringstream & p_message)
    {
        std::cout << p_message.str();
    }
}
Oliver Heidmann's avatar
Oliver Heidmann committed
10

11
12
13
14
15
16
17
namespace CdoDebug
{
    int PTHREAD;
    int PSTREAM;
    bool PROCESS;
    bool PIPE;
    int ARGUMENT;
Oliver Heidmann's avatar
Oliver Heidmann committed
18

19
20
21
    std::string outfile = "";
    bool print_to_seperate_file = false;
    std::fstream outfile_stream;
Oliver Heidmann's avatar
Oliver Heidmann committed
22

23
24
25
26
    std::string
    get_padding(const char *p_func)
    {
      size_t len = strlen(p_func);
27

28
29
      return std::string(30 - len, ' ');
    }
30

31
32
33
34
35
    void
    CdoStartMessage()
    {
      std::stringstream message;
      outfile_stream = std::fstream(outfile, std::fstream::in | std::fstream::app);
Oliver Heidmann's avatar
Oliver Heidmann committed
36

37
38
39
40
41
42
43
44
45
46
47
48
      message << std::string(30, ' ') << "  == CDO Start ==" << std::endl;
      printMessage(message);
    }
    void
    CdoEndMessage()
    {
      std::stringstream message;
      message << std::string(30, ' ') << "  == CDO End ==" << std::endl;
      printMessage(message);
      outfile_stream.close();
    }
}