-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.cpp
76 lines (62 loc) · 2.11 KB
/
debug.cpp
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* Copyright (C) Johnny Saenz
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. */
#include <iostream>
#include "debug.h"
#define ACTUAL_LEVEL 0
// Constants
namespace
{
const int INFO = 1;
const int NOTICE = 2;
const int WARNING = 4;
const int ERROR = 8;
}
// Debug::message_
// --------------------------------------------------------------------
//
void Debug::message_( int level, const std::string& debug_message )
{
if( level <= ACTUAL_LEVEL )
std::cerr << "|Debug::Info | " << debug_message << std::endl;
else if( level <= ACTUAL_LEVEL )
std::cerr << "|Debug::Notice | " << debug_message << std::endl;
else if( level <= ACTUAL_LEVEL )
std::cerr << "|Debug::Warning | " << debug_message << std::endl;
else if( level <= ACTUAL_LEVEL )
std::cerr << "|Debug::Error | " << debug_message << std::endl;
}
// Debug::Info
// --------------------------------------------------------------------
//
void Debug::Info( const std::string& m )
{
message_( INFO, m );
}
// Debug::Notice
// --------------------------------------------------------------------
//
void Debug::Notice( const std::string& m )
{
message_( NOTICE, m );
}
// Debug::Warning
// --------------------------------------------------------------------
//
void Debug::Warning( const std::string& m )
{
message_( WARNING, m );
}
// Debug::Error
// --------------------------------------------------------------------
//
void Debug::Error( const std::string& m )
{
message_( ERROR, m );
}