Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor 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
schwede
openstructure
Commits
20ecef1f
Commit
20ecef1f
authored
14 years ago
by
Marco Biasini
Browse files
Options
Downloads
Patches
Plain Diff
added SCRIPT logging level
parent
56874070
Branches
Branches containing commit
Tags
1.0.0
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
modules/base/doc/logging.rst
+11
-7
11 additions, 7 deletions
modules/base/doc/logging.rst
modules/base/pymod/export_logger.cc
+2
-0
2 additions, 0 deletions
modules/base/pymod/export_logger.cc
modules/base/src/log.hh
+6
-4
6 additions, 4 deletions
modules/base/src/log.hh
with
19 additions
and
11 deletions
modules/base/doc/logging.rst
+
11
−
7
View file @
20ecef1f
...
...
@@ -19,10 +19,10 @@ OpenStructure has a logging system going beyond what print statements can offer.
.. note::
In C++, the logging facility is implemented as a set of macros, called
`LOG_ERROR`, `LOG_WARNING`, `LOG_INFO`, `LOG_VERBOSE`,
`LOG_DEBUG` and
`LOG_TRACE`. The last two are only active when compiling with
debugging
symbols. When debugging symbols are off, they expand to an empty
macro and
thus don't create any overhead.
`LOG_ERROR`, `LOG_WARNING`,
`LOG_SCRIPT`,
`LOG_INFO`, `LOG_VERBOSE`,
`LOG_DEBUG` and
`LOG_TRACE`. The last two are only active when compiling with
debugging
symbols. When debugging symbols are off, they expand to an empty
macro and
thus don't create any overhead.
Verbosity Level
...
...
@@ -34,7 +34,7 @@ You can change the verbosity level with the following two methods:
Change the verbosity level to the given integer value. All log events
which have a severity above verbosity will be ignored. By default, the log
level is 2, meaning that errors, warnings and
info
logging events are
level is 2, meaning that errors, warnings and
script
logging events are
visible.
:type verbosity: :class:`int`
...
...
@@ -140,10 +140,14 @@ WARNING:
Diagnose potential problems that do not abort the execution, but may
point to a misconfiguration/misuse. This level is turned on by default.
SCRIPT:
Logging level that should be used from scripts, e.g. to report progress. These
logging messages are turned on by default.
INFO:
Informative and important messages that summarize a complex command, such as
information on a loaded file, or results from an algorithm. These logging
messages are turned on by default.
messages are
not
turned on by default.
VERBOSE:
Grey-zone between user and developer need, and perhaps the hardest to get
...
...
@@ -178,7 +182,7 @@ terminal (or the python shell in DNG). The logger also prints the current time.
ost.LogSink.__init__(self)
def LogMessage(self, message, severity):
levels=['ERROR', 'WARNING', 'INFO',
levels=['ERROR', 'WARNING',
'SCRIPT',
'INFO',
'VERBOSE', 'DEBUG', 'TRACE']
level=levels[severity]
print '%s[%s]: %s' % (level, str(datetime.datetime.now()), message),
...
...
This diff is collapsed.
Click to expand it.
modules/base/pymod/export_logger.cc
+
2
−
0
View file @
20ecef1f
...
...
@@ -73,6 +73,7 @@ void pop_log_sink()
void
log_error
(
const
String
&
m
)
{
LOG_ERROR
(
m
);}
void
log_warning
(
const
String
&
m
)
{
LOG_WARNING
(
m
);}
void
log_script
(
const
String
&
m
)
{
LOG_SCRIPT
(
m
);}
void
log_info
(
const
String
&
m
)
{
LOG_INFO
(
m
);}
void
log_verbose
(
const
String
&
m
)
{
LOG_VERBOSE
(
m
);}
...
...
@@ -109,6 +110,7 @@ void export_Logger()
def
(
"LogError"
,
log_error
);
def
(
"LogWarning"
,
log_warning
);
def
(
"LogInfo"
,
log_info
);
def
(
"LogScript"
,
log_script
)
def
(
"LogVerbose"
,
log_verbose
);
// this relatively ugly construct is required to work around a problem with
...
...
This diff is collapsed.
Click to expand it.
modules/base/src/log.hh
+
6
−
4
View file @
20ecef1f
...
...
@@ -35,10 +35,11 @@ public:
enum
LogLevel
{
QUIET
=
0
,
WARNING
=
1
,
INFO
=
2
,
VERBOSE
=
3
,
DEBUG
=
4
,
TRACE
=
5
SCRIPT
=
2
,
INFO
=
3
,
VERBOSE
=
4
,
DEBUG
=
5
,
TRACE
=
6
};
void
PushVerbosityLevel
(
int
level
);
...
...
@@ -82,6 +83,7 @@ private:
#define LOG_ERROR(m) OST_DO_LOGGING_(m, ::ost::Logger::QUIET)
#define LOG_WARNING(m) OST_DO_LOGGING_(m, ::ost::Logger::WARNING)
#define LOG_SCRIPT(m) OST_DO_LOGGING_(m, ::ost::Logger::SCRIPT)
#define LOG_INFO(m) OST_DO_LOGGING_(m, ::ost::Logger::INFO)
#define LOG_VERBOSE(m) OST_DO_LOGGING_(m, ::ost::Logger::VERBOSE)
#ifdef NDEBUG
...
...
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