IMP logo
IMP Reference Guide  2.17.0
The Integrative Modeling Platform
log_macros.h File Reference

Logging and error reporting support. More...

#include <IMP/kernel_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::CreateLogContext log_context__(IMP_CURRENT_FUNCTION)
 Beginning logging for a non-member function. More...
 
#define IMP_IF_LOG(level)
 Execute the code block if a certain level of logging is on. More...
 
#define IMP_LOG_CONTEXT(name)   IMP::CreateLogContext imp_log_context(name, nullptr)
 Create a new log context from a streamed name. More...
 
#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

Logging and error reporting support.

Copyright 2007-2022 IMP Inventors. All rights reserved.

Definition in file log_macros.h.

Macro Definition Documentation

#define IMP_ERROR (   expr)

Write a warning to standard error.

Parameters
[in]exprAn expression to be output to std::cerr. It is prefixed by "ERROR"

Definition at line 61 of file log_macros.h.

#define IMP_FUNCTION_LOG   IMP::CreateLogContext log_context__(IMP_CURRENT_FUNCTION)

Beginning logging for a non-member function.

Definition at line 293 of file log_macros.h.

#define IMP_IF_LOG (   level)

Execute the code block if a certain level of logging is on.

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 49 of file log_macros.h.

#define IMP_LOG_CONTEXT (   name)    IMP::CreateLogContext imp_log_context(name, nullptr)

Create a new log context from a streamed name.

Definition at line 297 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_PROGRESS( "Hi there, I'm very talkative. My favorite numbers are "
<< 1 << " " << 2 << " " << 3);

Definition at line 94 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 72 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 99 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 VERBOSE.

Usage:

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

Definition at line 83 of file log_macros.h.

#define IMP_OBJECT_LOG

Set the log level to the object's log level.

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::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)

Write a warning to a log.

Parameters
[in]exprAn expression to be output to the log. It is prefixed by "WARNING"

Definition at line 55 of file log_macros.h.

#define IMP_WARN_ONCE (   key,
  expr,
  context 
)

Write a warning once per context object.

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.