MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / DoTrace

Method DoTrace

src/core/debug.cpp:98–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96///////////////////////////////////////////////////////////////////////////////
97
98void cDebug::DoTrace(const char* format, va_list& args)
99{
100 size_t guard1 = 0xBABABABA;
101 char out[2048];
102 size_t guard2 = 0xBABABABA;
103
104 vsnprintf(out, 2048, format, args);
105
106 ASSERT(guard1 == 0xBABABABA && guard2 == 0xBABABABA); // string was too long
107 ASSERT(strlen(out) < 1024);
108
109 std::ostringstream ostr;
110 ostr.setf(std::ios::left);
111 ostr.width(40);
112 ostr << mLabel;
113 ostr.width(0);
114 ostr << out;
115
116
117 if ((mOutMask & OUT_STDOUT) != 0)
118 {
119 std::cout << ostr.str().c_str();
120 std::cout.flush();
121 }
122
123 //
124 //make it output to log file!
125 //
126 if ((mOutMask & OUT_FILE) != 0)
127 {
128 // the logfile is narrow chars only...
129 logfile.setf(std::ios::left);
130 logfile.width(40);
131 logfile << mLabel;
132 logfile.width(0);
133 logfile << out;
134 logfile.flush();
135 }
136}
137# ifdef DEBUG
138
139//

Callers

nothing calls this directly

Calls 1

c_strMethod · 0.80

Tested by

no test coverage detected