~leighman/ubuntu/raring/workrave/fix-desktop-file-2

« back to all changes in this revision

Viewing changes to frontend/applets/win32/src/Debug.h

  • Committer: Package Import Robot
  • Author(s): Michael Terry
  • Date: 2013-01-24 11:04:41 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: package-import@ubuntu.com-20130124110441-t06q3xlc7mp4406p
Tags: upstream-1.10
ImportĀ upstreamĀ versionĀ 1.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Debug.hh
2
 
//
3
 
// Copyright (C) 2001 - 2010 Rob Caelers <robc@krandor.nl>
4
 
// All rights reserved.
5
 
//
6
 
// This program is free software: you can redistribute it and/or modify
7
 
// it under the terms of the GNU General Public License as published by
8
 
// the Free Software Foundation, either version 3 of the License, or
9
 
// (at your option) any later version.
10
 
//
11
 
// This program is distributed in the hope that it will be useful,
12
 
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
// GNU General Public License for more details.
15
 
//
16
 
// You should have received a copy of the GNU General Public License
17
 
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 
//
19
 
 
20
 
#ifndef DEBUG_HH
21
 
#define DEBUG_HH
22
 
 
23
 
#include <assert.h>
24
 
 
25
 
#ifndef TRACING
26
 
 
27
 
#define TRACE_ENTER(x)
28
 
#define TRACE_ENTER_MSG(x,y)
29
 
#define TRACE_RETURN(x)
30
 
#define TRACE_EXIT()
31
 
#define TRACE_MSG(x)
32
 
 
33
 
#else
34
 
 
35
 
#include <iostream>
36
 
#include <iomanip>
37
 
#include <fstream>
38
 
#include <ctime>
39
 
 
40
 
extern std::ofstream g_log_stream;
41
 
 
42
 
class Debug
43
 
{
44
 
public:
45
 
  static void init();
46
 
  static std::string trace_get_time();
47
 
};
48
 
 
49
 
#define TRACE_ENTER(x)          const char *_trace_method_name = x; \
50
 
                                std::cerr << Debug::trace_get_time() << ">>> " << x << std::endl; \
51
 
                                std::cerr.flush();
52
 
 
53
 
#define TRACE_ENTER_MSG(x, y)   const char *_trace_method_name = x; \
54
 
                                std::cerr << Debug::trace_get_time() << ">>> " << x << " " << y << std::endl; \
55
 
                                std::cerr.flush();
56
 
 
57
 
#define TRACE_RETURN(y)         std::cerr << Debug::trace_get_time() << "<<< " << _trace_method_name << y << std::endl; \
58
 
                                std::cerr.flush();
59
 
 
60
 
#define TRACE_EXIT()            std::cerr << Debug::trace_get_time() << "<<< " << _trace_method_name << std::endl; \
61
 
                                std::cerr.flush();
62
 
 
63
 
#define TRACE_MSG(msg)          std::cerr << Debug::trace_get_time() << "    " << _trace_method_name << " " << msg  << std::endl; \
64
 
                                std::cerr.flush();
65
 
 
66
 
#endif // TRACING
67
 
 
68
 
#endif // DEBUG_H