author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Fri, 26 Oct 2007 22:10:52 +0200 | |
changeset 2040 | 3436ba2b4bf4 |
parent 1783 | 36472385a1cc |
child 1828 | 6ab68edddf45 |
permissions | -rw-r--r-- |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
2 |
/* |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
3 |
* Copyright (c) 2006,2007 INRIA |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
4 |
* |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
8 |
* |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
13 |
* |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
17 |
* |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
19 |
*/ |
1506
3c8b23550e6a
disable log unless debug build
Craig Dowell <craigdo@ee.washington.edu>
parents:
1503
diff
changeset
|
20 |
|
1783
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
21 |
// What about print-list!!!!!!??????? |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
22 |
|
1506
3c8b23550e6a
disable log unless debug build
Craig Dowell <craigdo@ee.washington.edu>
parents:
1503
diff
changeset
|
23 |
#ifdef NS3_LOG_ENABLE |
3c8b23550e6a
disable log unless debug build
Craig Dowell <craigdo@ee.washington.edu>
parents:
1503
diff
changeset
|
24 |
|
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
25 |
#include <list> |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
26 |
#include <utility> |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
27 |
#include <iostream> |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
28 |
#include "log.h" |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
29 |
#include "assert.h" |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
30 |
#include "ns3/core-config.h" |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
31 |
#include "fatal-error.h" |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
32 |
|
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
33 |
#ifdef HAVE_STDLIB_H |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
34 |
#include <stdlib.h> |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
35 |
#endif |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
36 |
|
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
37 |
namespace ns3 { |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
38 |
|
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
39 |
typedef std::list<std::pair <std::string, LogComponent *> > ComponentList; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
40 |
typedef std::list<std::pair <std::string, LogComponent *> >::iterator ComponentListI; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
41 |
|
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
42 |
static |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
43 |
ComponentList *GetComponentList (void) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
44 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
45 |
static ComponentList components; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
46 |
return &components; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
47 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
48 |
|
1783
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
49 |
LogComponent::LogComponent (char const * name) |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
50 |
: m_levels (0), m_name (name) |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
51 |
{ |
1783
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
52 |
EnvVarCheck (name); |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
53 |
|
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
54 |
ComponentList *components = GetComponentList (); |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
55 |
for (ComponentListI i = components->begin (); |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
56 |
i != components->end (); |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
57 |
i++) |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
58 |
{ |
1783
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
59 |
NS_ASSERT (i->first != name); |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
60 |
} |
1783
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
61 |
components->push_back (std::make_pair (name, this)); |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
62 |
} |
1775
5abf6f0d1eca
deal with static constructor problem
Craig Dowell <craigdo@ee.washington.edu>
parents:
1773
diff
changeset
|
63 |
|
1783
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
64 |
void |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
65 |
LogComponent::EnvVarCheck (char const * name) |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
66 |
{ |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
67 |
#ifdef HAVE_GETENV |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
68 |
char *envVar = getenv("NS_LOG"); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
69 |
if (envVar == 0) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
70 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
71 |
return; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
72 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
73 |
std::string env = envVar; |
1783
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
74 |
std::string myName = name; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
75 |
|
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
76 |
std::string::size_type cur = 0; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
77 |
std::string::size_type next = 0; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
78 |
while (true) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
79 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
80 |
next = env.find_first_of (";", cur); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
81 |
std::string tmp = std::string (env, cur, next); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
82 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
83 |
/* The following code is a workaround for a bug in the g++ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
84 |
* c++ string library. Its goal is to remove any trailing ';' |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
85 |
* from the string even though there should not be any in |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
86 |
* it. This code should be safe even if the bug is not there. |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
87 |
*/ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
88 |
std::string::size_type trailing = tmp.find_first_of (";"); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
89 |
tmp = tmp.substr (0, trailing); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
90 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
91 |
if (tmp.size () == 0) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
92 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
93 |
break; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
94 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
95 |
std::string::size_type equal = tmp.find ("="); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
96 |
std::string component; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
97 |
if (equal == std::string::npos) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
98 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
99 |
component = tmp; |
1783
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
100 |
if (component == myName || component == "*") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
101 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
102 |
Enable (LOG_DEBUG); |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
103 |
return; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
104 |
} |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
105 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
106 |
else |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
107 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
108 |
component = tmp.substr (0, equal); |
1783
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
109 |
if (component == myName || component == "*") |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
110 |
{ |
1783
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
111 |
int level = 0; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
112 |
std::string::size_type cur_lev; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
113 |
std::string::size_type next_lev = equal; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
114 |
do |
1503
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
115 |
{ |
1783
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
116 |
cur_lev = next_lev + 1; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
117 |
next_lev = tmp.find ("|", cur_lev); |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
118 |
std::string lev = tmp.substr (cur_lev, next_lev - cur_lev); |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
119 |
if (lev == "error") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
120 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
121 |
level |= LOG_ERROR; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
122 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
123 |
else if (lev == "warn") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
124 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
125 |
level |= LOG_WARN; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
126 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
127 |
else if (lev == "debug") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
128 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
129 |
level |= LOG_DEBUG; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
130 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
131 |
else if (lev == "info") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
132 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
133 |
level |= LOG_INFO; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
134 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
135 |
else if (lev == "function") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
136 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
137 |
level |= LOG_FUNCTION; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
138 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
139 |
else if (lev == "param") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
140 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
141 |
level |= LOG_PARAM; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
142 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
143 |
else if (lev == "logic") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
144 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
145 |
level |= LOG_LOGIC; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
146 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
147 |
else if (lev == "all") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
148 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
149 |
level |= LOG_ALL; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
150 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
151 |
else if (lev == "prefix") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
152 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
153 |
level |= LOG_PREFIX_ALL; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
154 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
155 |
else if (lev == "level_error") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
156 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
157 |
level |= LOG_LEVEL_ERROR; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
158 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
159 |
else if (lev == "level_warn") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
160 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
161 |
level |= LOG_LEVEL_WARN; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
162 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
163 |
else if (lev == "level_debug") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
164 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
165 |
level |= LOG_LEVEL_DEBUG; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
166 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
167 |
else if (lev == "level_info") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
168 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
169 |
level |= LOG_LEVEL_INFO; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
170 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
171 |
else if (lev == "level_function") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
172 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
173 |
level |= LOG_LEVEL_FUNCTION; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
174 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
175 |
else if (lev == "level_param") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
176 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
177 |
level |= LOG_LEVEL_PARAM; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
178 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
179 |
else if (lev == "level_logic") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
180 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
181 |
level |= LOG_LEVEL_LOGIC; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
182 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
183 |
else if (lev == "level_all") |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
184 |
{ |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
185 |
level |= LOG_LEVEL_ALL; |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
186 |
} |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
187 |
} while (next_lev != std::string::npos); |
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
188 |
|
36472385a1cc
NS_LOG parsing changes to address bug 91
Craig Dowell <craigdo@ee.washington.edu>
parents:
1775
diff
changeset
|
189 |
Enable ((enum LogLevel)level); |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
190 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
191 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
192 |
if (next == std::string::npos) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
193 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
194 |
break; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
195 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
196 |
cur = next + 1; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
197 |
if (cur >= env.size ()) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
198 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
199 |
break; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
200 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
201 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
202 |
#endif |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
203 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
204 |
|
1503
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
205 |
|
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
206 |
bool |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
207 |
LogComponent::IsEnabled (enum LogLevel level) const |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
208 |
{ |
1775
5abf6f0d1eca
deal with static constructor problem
Craig Dowell <craigdo@ee.washington.edu>
parents:
1773
diff
changeset
|
209 |
// LogComponentEnableEnvVar (); |
1507
11a370eecc52
allow discrete levels
Craig Dowell <craigdo@ee.washington.edu>
parents:
1506
diff
changeset
|
210 |
return (level & m_levels) ? 1 : 0; |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
211 |
} |
1503
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
212 |
|
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
213 |
bool |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
214 |
LogComponent::IsNoneEnabled (void) const |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
215 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
216 |
return m_levels == 0; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
217 |
} |
1503
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
218 |
|
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
219 |
void |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
220 |
LogComponent::Enable (enum LogLevel level) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
221 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
222 |
m_levels |= level; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
223 |
} |
1503
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
224 |
|
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
225 |
void |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
226 |
LogComponent::Disable (enum LogLevel level) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
227 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
228 |
m_levels &= ~level; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
229 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
230 |
|
1772
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
231 |
char const * |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
232 |
LogComponent::Name (void) const |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
233 |
{ |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
234 |
return m_name; |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
235 |
} |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
236 |
|
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
237 |
|
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
238 |
void |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
239 |
LogComponentEnable (char const *name, enum LogLevel level) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
240 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
241 |
ComponentList *components = GetComponentList (); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
242 |
for (ComponentListI i = components->begin (); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
243 |
i != components->end (); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
244 |
i++) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
245 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
246 |
if (i->first.compare (name) == 0) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
247 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
248 |
i->second->Enable (level); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
249 |
break; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
250 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
251 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
252 |
} |
1503
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
253 |
|
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
254 |
void |
1772
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
255 |
LogComponentEnableAll (enum LogLevel level) |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
256 |
{ |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
257 |
ComponentList *components = GetComponentList (); |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
258 |
for (ComponentListI i = components->begin (); |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
259 |
i != components->end (); |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
260 |
i++) |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
261 |
{ |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
262 |
i->second->Enable (level); |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
263 |
} |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
264 |
} |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
265 |
|
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
266 |
void |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
267 |
LogComponentDisable (char const *name, enum LogLevel level) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
268 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
269 |
ComponentList *components = GetComponentList (); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
270 |
for (ComponentListI i = components->begin (); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
271 |
i != components->end (); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
272 |
i++) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
273 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
274 |
if (i->first.compare (name) == 0) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
275 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
276 |
i->second->Disable (level); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
277 |
break; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
278 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
279 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
280 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
281 |
|
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
282 |
void |
1772
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
283 |
LogComponentDisableAll (enum LogLevel level) |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
284 |
{ |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
285 |
ComponentList *components = GetComponentList (); |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
286 |
for (ComponentListI i = components->begin (); |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
287 |
i != components->end (); |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
288 |
i++) |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
289 |
{ |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
290 |
i->second->Disable (level); |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
291 |
} |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
292 |
} |
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
293 |
|
dd278e20e52e
log verbosity changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
1507
diff
changeset
|
294 |
void |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
295 |
LogComponentPrintList (void) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
296 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
297 |
ComponentList *components = GetComponentList (); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
298 |
for (ComponentListI i = components->begin (); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
299 |
i != components->end (); |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
300 |
i++) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
301 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
302 |
std::cout << i->first << "="; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
303 |
if (i->second->IsNoneEnabled ()) |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
304 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
305 |
std::cout << "0" << std::endl; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
306 |
continue; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
307 |
} |
1507
11a370eecc52
allow discrete levels
Craig Dowell <craigdo@ee.washington.edu>
parents:
1506
diff
changeset
|
308 |
if (i->second->IsEnabled (LOG_ERROR)) |
1503
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
309 |
{ |
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
310 |
std::cout << "error"; |
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
311 |
} |
1507
11a370eecc52
allow discrete levels
Craig Dowell <craigdo@ee.washington.edu>
parents:
1506
diff
changeset
|
312 |
if (i->second->IsEnabled (LOG_WARN)) |
1503
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
313 |
{ |
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
314 |
std::cout << "|warn"; |
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
315 |
} |
1507
11a370eecc52
allow discrete levels
Craig Dowell <craigdo@ee.washington.edu>
parents:
1506
diff
changeset
|
316 |
if (i->second->IsEnabled (LOG_DEBUG)) |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
317 |
{ |
1503
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
318 |
std::cout << "|debug"; |
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
319 |
} |
1507
11a370eecc52
allow discrete levels
Craig Dowell <craigdo@ee.washington.edu>
parents:
1506
diff
changeset
|
320 |
if (i->second->IsEnabled (LOG_INFO)) |
1503
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
321 |
{ |
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
322 |
std::cout << "|info"; |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
323 |
} |
1507
11a370eecc52
allow discrete levels
Craig Dowell <craigdo@ee.washington.edu>
parents:
1506
diff
changeset
|
324 |
if (i->second->IsEnabled (LOG_FUNCTION)) |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
325 |
{ |
1503
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
326 |
std::cout << "|function"; |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
327 |
} |
1507
11a370eecc52
allow discrete levels
Craig Dowell <craigdo@ee.washington.edu>
parents:
1506
diff
changeset
|
328 |
if (i->second->IsEnabled (LOG_PARAM)) |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
329 |
{ |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
330 |
std::cout << "|param"; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
331 |
} |
1507
11a370eecc52
allow discrete levels
Craig Dowell <craigdo@ee.washington.edu>
parents:
1506
diff
changeset
|
332 |
if (i->second->IsEnabled (LOG_LOGIC)) |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
333 |
{ |
1503
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
334 |
std::cout << "|logic"; |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
335 |
} |
1507
11a370eecc52
allow discrete levels
Craig Dowell <craigdo@ee.washington.edu>
parents:
1506
diff
changeset
|
336 |
if (i->second->IsEnabled (LOG_ALL)) |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
337 |
{ |
1503
53dd8f414ba6
sorting out logging
Craig Dowell <craigdo@ee.washington.edu>
parents:
1498
diff
changeset
|
338 |
std::cout << "|all"; |
1498
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
339 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
340 |
std::cout << std::endl; |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
341 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
342 |
} |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
343 |
|
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
344 |
} // namespace ns3 |
520bc8457799
log rides along for free
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
345 |
|
1506
3c8b23550e6a
disable log unless debug build
Craig Dowell <craigdo@ee.washington.edu>
parents:
1503
diff
changeset
|
346 |
#endif // NS3_LOG_ENABLE |