IMP  2.1.0
The Integrative Modeling Platform
base/log_macros.h File Reference

Logging and error reporting support. More...

#include <IMP/base/base_config.h>
#include "enums.h"
#include "log.h"
#include "CreateLogContext.h"
#include "compiler_macros.h"
#include "SetCheckState.h"
#include "internal/log.h"
#include <sstream>
+ Include dependency graph for base/log_macros.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IMP_ERROR(expr)
 Write a warning to standard error. More...
 
#define IMP_ERROR_WRITE(expr)
 
#define IMP_FUNCTION_LOG   IMP::base::CreateLogContext log_context__(IMP_CURRENT_FUNCTION)
 Beginning logging for a non-member function.
 
#define IMP_IF_LOG(level)
 Execute the code block if a certain level of logging is on. More...
 
#define IMP_LOG_CONTEXT(name)   IMP::base::CreateLogContext imp_log_context(name, nullptr)
 Create a new log context from a streamed name.
 
#define IMP_LOG_PROGRESS(expr)
 
#define IMP_LOG_TERSE(expr)
 
#define IMP_LOG_VARIABLE(variable)
 
#define IMP_LOG_VERBOSE(expr)
 
#define IMP_LOG_WRITE(level, expr)
 
#define IMP_OBJECT_LOG
 Set the log level to the object's log level. More...
 
#define IMP_PROGRESS_DISPLAY(name, steps)
 
#define IMP_WARN(expr)
 Write a warning to a log. More...
 
#define IMP_WARN_ONCE(key, expr, context)
 Write a warning once per context object. More...
 
#define IMP_WARN_WRITE(expr)
 

Detailed Description

Copyright 2007-2013 IMP Inventors. All rights reserved.

Definition in file base/log_macros.h.

Macro Definition Documentation

#define IMP_ERROR (   expr)
Parameters
[in]exprAn expression to be output to std::cerr. It is prefixed by "ERROR"

Definition at line 72 of file base/log_macros.h.

#define IMP_IF_LOG (   level)

The next code block (delimited by { }) is executed if get_log_level() >= level.

Floats testp(input.begin(), input.end());
std::sort(testp.begin(), testp.end());
IMP_LOG_VERBOSE( "Sorted order is ");
IMP_LOG_WRITE(VERBOSE, std::copy(testp.begin(), testp.end(),
std::ostream_iterator<double>(IMP_STREAM, " ")));
}

Definition at line 60 of file base/log_macros.h.

#define IMP_LOG_PROGRESS (   expr)
Parameters
[in]exprA stream expression to be sent to the output stream if the log level is at least PROGRESS.

Usage:

IMP_LOG_VERBOSE( "Hi there, I'm very talkative. My favorite numbers are "
<< 1 << " " << 2 << " " << 3);

Definition at line 105 of file base/log_macros.h.

#define IMP_LOG_TERSE (   expr)
Parameters
[in]exprA stream expression to be sent to the output stream if the log level is at least TERSE.

Usage:

IMP_LOG_VERBOSE( "Hi there, I'm very talkative. My favorite numbers are "
<< 1 << " " << 2 << " " << 3);

Definition at line 83 of file base/log_macros.h.

#define IMP_LOG_VARIABLE (   variable)

Mark a variable as one that is only used in logging. This disables unused variable warnings on it in fast mode.

Definition at line 110 of file base/log_macros.h.

#define IMP_LOG_VERBOSE (   expr)
Parameters
[in]exprA stream expression to be sent to the output stream if the log level is at least TERSE.

Usage:

IMP_LOG_VERBOSE( "Hi there, I'm very talkative. My favorite numbers are "
<< 1 << " " << 2 << " " << 3);

Definition at line 94 of file base/log_macros.h.

#define IMP_OBJECT_LOG

All non-trivial Object methods should start with this. It creates a RAII-style object which sets the log level to the local one, if appropriate, until it goes out of scope.

Definition at line 296 of file base/log_macros.h.

#define IMP_PROGRESS_DISPLAY (   name,
  steps 
)

Like IMP::base::set_progress_display() but you can use stream operations for the name.

Definition at line 328 of file base/log_macros.h.

#define IMP_WARN (   expr)
Parameters
[in]exprAn expression to be output to the log. It is prefixed by "WARNING"

Definition at line 66 of file base/log_macros.h.

#define IMP_WARN_ONCE (   key,
  expr,
  context 
)

Use this macro to, for example, warn on unprocessable fields in a PDB, since they tend to come together. The key is what is tested for uniqueness, the expr is what is output.

Warnings are only output when the context object is destroyed.

Definition at line 319 of file base/log_macros.h.