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
d4228e21
Commit
d4228e21
authored
7 years ago
by
Julien Michel
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Make std::cout the default output for library logs
parent
f703e27a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!20
Refactor logging for the whole library
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Modules/Core/Common/include/otbLogger.h
+1
-2
1 addition, 2 deletions
Modules/Core/Common/include/otbLogger.h
Modules/Core/Common/src/otbLogger.cxx
+10
-0
10 additions, 0 deletions
Modules/Core/Common/src/otbLogger.cxx
with
11 additions
and
2 deletions
Modules/Core/Common/include/otbLogger.h
+
1
−
2
View file @
d4228e21
...
@@ -45,13 +45,12 @@ public:
...
@@ -45,13 +45,12 @@ public:
itkTypeMacro
(
Logger
,
itk
::
Logger
);
itkTypeMacro
(
Logger
,
itk
::
Logger
);
static
Pointer
Instance
();
static
Pointer
Instance
();
itkNewMacro
(
Self
);
// Overwrite this to provide custom formatting of log entries
// Overwrite this to provide custom formatting of log entries
virtual
std
::
string
BuildFormattedEntry
(
itk
::
Logger
::
PriorityLevelType
,
std
::
string
const
&
)
ITK_OVERRIDE
;
virtual
std
::
string
BuildFormattedEntry
(
itk
::
Logger
::
PriorityLevelType
,
std
::
string
const
&
)
ITK_OVERRIDE
;
protected:
protected:
itkNewMacro
(
Self
);
Logger
();
Logger
();
virtual
~
Logger
()
ITK_OVERRIDE
;
virtual
~
Logger
()
ITK_OVERRIDE
;
...
...
This diff is collapsed.
Click to expand it.
Modules/Core/Common/src/otbLogger.cxx
+
10
−
0
View file @
d4228e21
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
#include
"otbLogger.h"
#include
"otbLogger.h"
#include
"itksys/SystemTools.hxx"
#include
"itksys/SystemTools.hxx"
#include
"otbConfigurationManager.h"
#include
"otbConfigurationManager.h"
#include
"itkStdStreamLogOutput.h"
#include
<iostream>
namespace
otb
namespace
otb
{
{
...
@@ -30,8 +32,16 @@ Logger::Pointer Logger::Singleton = ITK_NULLPTR;
...
@@ -30,8 +32,16 @@ Logger::Pointer Logger::Singleton = ITK_NULLPTR;
Logger
::
Pointer
Logger
::
Instance
()
Logger
::
Pointer
Logger
::
Instance
()
{
{
if
(
!
Logger
::
Singleton
)
if
(
!
Logger
::
Singleton
)
{
Logger
::
Singleton
=
Logger
::
New
();
Logger
::
Singleton
=
Logger
::
New
();
// By default, redirect logs to std::cout
itk
::
StdStreamLogOutput
::
Pointer
defaultOutput
=
itk
::
StdStreamLogOutput
::
New
();
defaultOutput
->
SetStream
(
std
::
cout
);
Logger
::
Singleton
->
AddLogOutput
(
defaultOutput
);
}
return
Logger
::
Singleton
;
return
Logger
::
Singleton
;
}
}
...
...
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