IMP  2.0.0
The Integrative Modeling Platform
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 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__(__func__)
 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 long 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 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 73 of file 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 61 of file 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 106 of file 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 84 of file 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 111 of file 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 95 of file 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 284 of file 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 316 of file 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 67 of file 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 307 of file log_macros.h.