Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main Repositories
otb
Commits
bc8c365b
Commit
bc8c365b
authored
6 years ago
by
Guillaume Pasero
Browse files
Options
Downloads
Patches
Plain Diff
ENH: filter watcher logs for non-interactive cout
parent
eb690f1b
No related branches found
No related tags found
2 merge requests
!621
Release 7.0 (master)
,
!364
No progress to file
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Modules/Core/Common/include/otbStandardOneLineFilterWatcher.h
+4
-0
4 additions, 0 deletions
...les/Core/Common/include/otbStandardOneLineFilterWatcher.h
Modules/Core/Common/src/otbStandardOneLineFilterWatcher.cxx
+29
-9
29 additions, 9 deletions
Modules/Core/Common/src/otbStandardOneLineFilterWatcher.cxx
with
33 additions
and
9 deletions
Modules/Core/Common/include/otbStandardOneLineFilterWatcher.h
+
4
−
0
View file @
bc8c365b
...
...
@@ -93,6 +93,10 @@ private:
int
m_StarsCount
;
int
m_CurrentNbStars
;
bool
m_CoutIsConsole
;
std
::
string
m_Buffer
;
};
}
// end namespace otb
...
...
This diff is collapsed.
Click to expand it.
Modules/Core/Common/src/otbStandardOneLineFilterWatcher.cxx
+
29
−
9
View file @
bc8c365b
...
...
@@ -24,6 +24,7 @@
#include
"otbStandardOneLineFilterWatcher.h"
#include
"otbStopwatch.h"
#include
"otbSystem.h"
namespace
otb
{
...
...
@@ -31,7 +32,8 @@ namespace otb
StandardOneLineFilterWatcher
::
StandardOneLineFilterWatcher
()
:
m_StarsCount
(
50
),
m_CurrentNbStars
(
-
1
)
m_CurrentNbStars
(
-
1
),
m_CoutIsConsole
(
System
::
IsInteractive
(
1
)
)
{
}
...
...
@@ -40,7 +42,8 @@ StandardOneLineFilterWatcher
const
char
*
comment
)
:
FilterWatcherBase
(
process
,
comment
),
m_StarsCount
(
50
),
m_CurrentNbStars
(
-
1
)
m_CurrentNbStars
(
-
1
),
m_CoutIsConsole
(
System
::
IsInteractive
(
1
)
)
{
}
...
...
@@ -49,7 +52,8 @@ StandardOneLineFilterWatcher
const
std
::
string
&
comment
)
:
FilterWatcherBase
(
process
,
comment
.
c_str
()),
m_StarsCount
(
50
),
m_CurrentNbStars
(
-
1
)
m_CurrentNbStars
(
-
1
),
m_CoutIsConsole
(
System
::
IsInteractive
(
1
)
)
{
}
...
...
@@ -82,12 +86,22 @@ StandardOneLineFilterWatcher
{
std
::
string
stars
(
nbStars
,
'*'
);
std
::
string
blanks
(
nbBlanks
,
' '
);
std
::
cout
<<
"
\r
"
<<
m_Comment
<<
": "
<<
progressPercent
<<
"% ["
<<
stars
<<
blanks
<<
"]"
<<
std
::
flush
;
if
(
m_CoutIsConsole
)
{
std
::
cout
<<
"
\r
"
<<
m_Comment
<<
": "
<<
progressPercent
<<
"% ["
<<
stars
<<
blanks
<<
"]"
<<
std
::
flush
;
}
else
{
std
::
ostringstream
oss
;
oss
<<
m_Comment
<<
": "
<<
progressPercent
<<
"% ["
<<
stars
<<
blanks
<<
"]"
;
m_Buffer
=
oss
.
str
();
}
}
m_CurrentNbStars
=
nbStars
;
...
...
@@ -107,6 +121,12 @@ StandardOneLineFilterWatcher
{
m_Stopwatch
.
Stop
();
if
(
m_Process
&&
!
m_CoutIsConsole
)
{
std
::
cout
<<
m_Buffer
;
m_Buffer
=
std
::
string
(
""
);
}
std
::
cout
<<
" ("
;
m_Stopwatch
.
GetElapsedHumanReadableTime
(
std
::
cout
);
std
::
cout
<<
")"
...
...
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