Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
cfe37cbf
Commit
cfe37cbf
authored
13 years ago
by
Nat Goodspeed
Browse files
Options
Downloads
Patches
Plain Diff
Break out std::ostream << CaptureLog routine for general use.
parent
0ef99cd3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llcommon/tests/wrapllerrs.h
+20
-9
20 additions, 9 deletions
indra/llcommon/tests/wrapllerrs.h
with
20 additions
and
9 deletions
indra/llcommon/tests/wrapllerrs.h
+
20
−
9
View file @
cfe37cbf
...
@@ -31,11 +31,11 @@
...
@@ -31,11 +31,11 @@
#include
<tut/tut.hpp>
#include
<tut/tut.hpp>
#include
"llerrorcontrol.h"
#include
"llerrorcontrol.h"
#include
"stringize.h"
#include
<boost/bind.hpp>
#include
<boost/bind.hpp>
#include
<list>
#include
<list>
#include
<string>
#include
<string>
#include
<stdexcept>
#include
<stdexcept>
#include
<sstream>
// statically reference the function in test.cpp... it's short, we could
// statically reference the function in test.cpp... it's short, we could
// replicate, but better to reuse
// replicate, but better to reuse
...
@@ -131,14 +131,9 @@ class CaptureLog : public LLError::Recorder
...
@@ -131,14 +131,9 @@ class CaptureLog : public LLError::Recorder
if
(
!
required
)
if
(
!
required
)
return
std
::
string
();
return
std
::
string
();
std
::
ostringstream
out
;
throw
tut
::
failure
(
STRINGIZE
(
"failed to find '"
<<
search
out
<<
"failed to find '"
<<
search
<<
"' in captured log messages:"
;
<<
"' in captured log messages:
\n
"
for
(
MessageList
::
const_iterator
mi
(
mMessages
.
begin
()),
mend
(
mMessages
.
end
());
<<
*
this
));
mi
!=
mend
;
++
mi
)
{
out
<<
'\n'
<<
*
mi
;
}
throw
tut
::
failure
(
out
.
str
());
}
}
typedef
std
::
list
<
std
::
string
>
MessageList
;
typedef
std
::
list
<
std
::
string
>
MessageList
;
...
@@ -146,4 +141,20 @@ class CaptureLog : public LLError::Recorder
...
@@ -146,4 +141,20 @@ class CaptureLog : public LLError::Recorder
LLError
::
Settings
*
mOldSettings
;
LLError
::
Settings
*
mOldSettings
;
};
};
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
CaptureLog
&
log
)
{
CaptureLog
::
MessageList
::
const_iterator
mi
(
log
.
mMessages
.
begin
()),
mend
(
log
.
mMessages
.
end
());
if
(
mi
!=
mend
)
{
// handle first message separately: it doesn't get a newline
out
<<
*
mi
++
;
for
(
;
mi
!=
mend
;
++
mi
)
{
// every subsequent message gets a newline
out
<<
'\n'
<<
*
mi
;
}
}
return
out
;
}
#endif
/* ! defined(LL_WRAPLLERRS_H) */
#endif
/* ! defined(LL_WRAPLLERRS_H) */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment