console.h File Reference

#include <cstdio>
#include <sstream>
#include <ros/time.h>
#include <log4cxx/logger.h>
#include "rosconsole/macros_generated.h"
Include dependency graph for console.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ros::console::FilterBase
 Base-class for filters. Filters allow full user-defined control over whether or not a message should print. The ROS_X_FILTER... macros provide the filtering functionality. More...
struct  ros::console::FilterParams
 Parameter structure passed to FilterBase::isEnabled(...);. Includes both input and output parameters. More...
struct  ros::console::LogLocation
 Internal. More...

Namespaces

namespace  boost
namespace  log4cxx
namespace  log4cxx::helpers
namespace  ros
namespace  ros::console
namespace  ros::console::levels

Defines

#define __ROSCONSOLE_FUNCTION__   ""
#define ROS_LIKELY(x)   __builtin_expect((x),1)
#define ROS_LOG(level, name,...)   ROS_LOG_COND(true, level, name, __VA_ARGS__)
 Log to a given named logger at a given verbosity level, with printf-style formatting.
#define ROS_LOG_COND(cond, level, name,...)
 Log to a given named logger at a given verbosity level, only if a given condition has been met, with printf-style formatting.
#define ROS_LOG_FILTER(filter, level, name,...)
 Log to a given named logger at a given verbosity level, with user-defined filtering, with printf-style formatting.
#define ROS_LOG_ONCE(level, name,...)
 Log to a given named logger at a given verbosity level, only the first time it is hit when enabled, with printf-style formatting.
#define ROS_LOG_STREAM(level, name, args)   ROS_LOG_STREAM_COND(true, level, name, args)
 Log to a given named logger at a given verbosity level, with stream-style formatting.
#define ROS_LOG_STREAM_COND(cond, level, name, args)
 Log to a given named logger at a given verbosity level, only if a given condition has been met, with stream-style formatting.
#define ROS_LOG_STREAM_FILTER(filter, level, name, args)
 Log to a given named logger at a given verbosity level, with user-defined filtering, with stream-style formatting.
#define ROS_LOG_STREAM_ONCE(level, name, args)
 Log to a given named logger at a given verbosity level, only the first time it is hit when enabled, with printf-style formatting.
#define ROS_LOG_STREAM_THROTTLE(rate, level, name, args)
 Log to a given named logger at a given verbosity level, limited to a specific rate of printing, with printf-style formatting.
#define ROS_LOG_THROTTLE(rate, level, name,...)
 Log to a given named logger at a given verbosity level, limited to a specific rate of printing, with printf-style formatting.
#define ROS_UNLIKELY(x)   __builtin_expect((x),0)
#define ROSCONSOLE_AUTOINIT
 Initializes the rosconsole library. Usually unnecessary to call directly.
#define ROSCONSOLE_DEFAULT_NAME   ROSCONSOLE_NAME_PREFIX
#define ROSCONSOLE_DEFINE_LOCATION(cond, level, name)
#define ROSCONSOLE_MIN_SEVERITY   ROSCONSOLE_SEVERITY_DEBUG
#define ROSCONSOLE_NAME_PREFIX   ROSCONSOLE_ROOT_LOGGER_NAME "." ROSCONSOLE_PACKAGE_NAME
#define ROSCONSOLE_PACKAGE_NAME   "unknown_package"
#define ROSCONSOLE_PRINT_AT_LOCATION(...)   ROSCONSOLE_PRINT_AT_LOCATION_WITH_FILTER(0, __VA_ARGS__)
#define ROSCONSOLE_PRINT_AT_LOCATION_WITH_FILTER(filter,...)   ::ros::console::print(filter, loc.logger_, loc.level_, __FILE__, __LINE__, __ROSCONSOLE_FUNCTION__, __VA_ARGS__)
#define ROSCONSOLE_PRINT_STREAM_AT_LOCATION(args)   ROSCONSOLE_PRINT_STREAM_AT_LOCATION_WITH_FILTER(0, args)
#define ROSCONSOLE_PRINT_STREAM_AT_LOCATION_WITH_FILTER(filter, args)
#define ROSCONSOLE_PRINTF_ATTRIBUTE(a, b)
#define ROSCONSOLE_ROOT_LOGGER_NAME   "ros"
#define ROSCONSOLE_SEVERITY_DEBUG   0
#define ROSCONSOLE_SEVERITY_ERROR   3
#define ROSCONSOLE_SEVERITY_FATAL   4
#define ROSCONSOLE_SEVERITY_INFO   1
#define ROSCONSOLE_SEVERITY_NONE   5
#define ROSCONSOLE_SEVERITY_WARN   2

Typedefs

typedef levels::Level ros::console::Level
typedef helpers::ObjectPtrT
< Level > 
log4cxx::LevelPtr
typedef helpers::ObjectPtrT
< Logger > 
log4cxx::LoggerPtr

Enumerations

enum  ros::console::levels::Level {
  ros::console::levels::Debug, ros::console::levels::Info, ros::console::levels::Warn, ros::console::levels::Error,
  ros::console::levels::Fatal, ros::console::levels::Count
}

Functions

void ros::console::checkLogLocationEnabled (LogLocation *loc)
 Internal.
void ros::console::formatToBuffer (boost::shared_array< char > &buffer, size_t &buffer_size, const char *fmt,...)
std::string ros::console::formatToString (const char *fmt,...)
void ros::console::initialize ()
 Don't call this directly. Performs any required initialization/configuration. Happens automatically when using the macro API.
void ros::console::initializeLogLocation (LogLocation *loc, const std::string &name, Level level)
 Internal.
void ros::console::notifyLoggerLevelsChanged ()
 Tells the system that a logger's level has changed.
void void ros::console::print (FilterBase *filter, log4cxx::Logger *logger, Level level, const std::stringstream &str, const char *file, int line, const char *function)
void ros::console::print (FilterBase *filter, log4cxx::Logger *logger, Level level, const char *file, int line, const char *function, const char *fmt,...) ROSCONSOLE_PRINTF_ATTRIBUTE(7
 Don't call this directly. Use the ROS_LOG() macro instead.
void ros::console::registerLogLocation (LogLocation *loc)
 Registers a logging location with the system.
void ros::console::setFixedFilterToken (const std::string &key, const std::string &val)
void ros::console::setLogLocationLevel (LogLocation *loc, Level level)
 Internal.
void ros::console::shutdown ()
void ros::console::vformatToBuffer (boost::shared_array< char > &buffer, size_t &buffer_size, const char *fmt, va_list args)

Variables

bool ros::console::g_initialized = false
 Only exported because the macros need it. Do not use directly.
log4cxx::LevelPtr ros::console::g_level_lookup []

Define Documentation

#define __ROSCONSOLE_FUNCTION__   ""

Definition at line 245 of file console.h.

#define ROS_LIKELY (  )     __builtin_expect((x),1)

Definition at line 236 of file console.h.

#define ROS_LOG ( level,
name,
...   )     ROS_LOG_COND(true, level, name, __VA_ARGS__)

Log to a given named logger at a given verbosity level, with printf-style formatting.

Parameters:
level One of the levels specified in ros::console::levels::Level
name Name of the logger. Note that this is the fully qualified name, and does NOT include "ros.<package_name>". Use ROSCONSOLE_DEFAULT_NAME if you would like to use the default name.

Definition at line 475 of file console.h.

#define ROS_LOG_COND ( cond,
level,
name,
...   ) 
Value:
do \
  { \
    ROSCONSOLE_DEFINE_LOCATION(cond, level, name); \
    \
    if (ROS_UNLIKELY(enabled)) \
    { \
      ROSCONSOLE_PRINT_AT_LOCATION(__VA_ARGS__); \
    } \
  } while(0)

Log to a given named logger at a given verbosity level, only if a given condition has been met, with printf-style formatting.

Note:
The condition will only be evaluated if this logging statement is enabled
Parameters:
cond Boolean condition to be evaluated
level One of the levels specified in ros::console::levels::Level
name Name of the logger. Note that this is the fully qualified name, and does NOT include "ros.<package_name>". Use ROSCONSOLE_DEFAULT_NAME if you would like to use the default name.

Definition at line 329 of file console.h.

#define ROS_LOG_FILTER ( filter,
level,
name,
...   ) 
Value:
do \
  { \
    ROSCONSOLE_DEFINE_LOCATION(true, level, name); \
    if (ROS_UNLIKELY(enabled) && (filter)->isEnabled()) \
    { \
      ROSCONSOLE_PRINT_AT_LOCATION_WITH_FILTER(filter, __VA_ARGS__); \
    } \
  } while(0)

Log to a given named logger at a given verbosity level, with user-defined filtering, with printf-style formatting.

Parameters:
filter pointer to the filter to be used
level One of the levels specified in ros::console::levels::Level
name Name of the logger. Note that this is the fully qualified name, and does NOT include "ros.<package_name>". Use ROSCONSOLE_DEFAULT_NAME if you would like to use the default name.

Definition at line 442 of file console.h.

#define ROS_LOG_ONCE ( level,
name,
...   ) 
Value:
do \
  { \
    ROSCONSOLE_DEFINE_LOCATION(true, level, name); \
    static bool hit = false; \
    if (ROS_UNLIKELY(enabled) && ROS_UNLIKELY(!hit)) \
    { \
      hit = true; \
      ROSCONSOLE_PRINT_AT_LOCATION(__VA_ARGS__); \
    } \
  } while(0)

Log to a given named logger at a given verbosity level, only the first time it is hit when enabled, with printf-style formatting.

Parameters:
level One of the levels specified in ros::console::levels::Level
name Name of the logger. Note that this is the fully qualified name, and does NOT include "ros.<package_name>". Use ROSCONSOLE_DEFAULT_NAME if you would like to use the default name.

Definition at line 365 of file console.h.

#define ROS_LOG_STREAM ( level,
name,
args   )     ROS_LOG_STREAM_COND(true, level, name, args)

Log to a given named logger at a given verbosity level, with stream-style formatting.

Parameters:
level One of the levels specified in ros::console::levels::Level
name Name of the logger. Note that this is the fully qualified name, and does NOT include "ros.<package_name>". Use ROSCONSOLE_DEFAULT_NAME if you would like to use the default name.

Definition at line 482 of file console.h.

#define ROS_LOG_STREAM_COND ( cond,
level,
name,
args   ) 
Value:
do \
  { \
    ROSCONSOLE_DEFINE_LOCATION(cond, level, name); \
    if (ROS_UNLIKELY(enabled)) \
    { \
      ROSCONSOLE_PRINT_STREAM_AT_LOCATION(args); \
    } \
  } while(0)

Log to a given named logger at a given verbosity level, only if a given condition has been met, with stream-style formatting.

Note:
The condition will only be evaluated if this logging statement is enabled
Parameters:
cond Boolean condition to be evaluated
level One of the levels specified in ros::console::levels::Level
name Name of the logger. Note that this is the fully qualified name, and does NOT include "ros.<package_name>". Use ROSCONSOLE_DEFAULT_NAME if you would like to use the default name.

Definition at line 349 of file console.h.

#define ROS_LOG_STREAM_FILTER ( filter,
level,
name,
args   ) 
Value:
do \
  { \
    ROSCONSOLE_DEFINE_LOCATION(true, level, name); \
    if (ROS_UNLIKELY(enabled) && (filter)->isEnabled()) \
    { \
      ROSCONSOLE_PRINT_STREAM_AT_LOCATION_WITH_FILTER(filter, args); \
    } \
  } while(0)

Log to a given named logger at a given verbosity level, with user-defined filtering, with stream-style formatting.

Parameters:
cond Boolean condition to be evaluated
level One of the levels specified in ros::console::levels::Level
name Name of the logger. Note that this is the fully qualified name, and does NOT include "ros.<package_name>". Use ROSCONSOLE_DEFAULT_NAME if you would like to use the default name.

Definition at line 459 of file console.h.

#define ROS_LOG_STREAM_ONCE ( level,
name,
args   ) 
Value:
do \
  { \
    ROSCONSOLE_DEFINE_LOCATION(true, level, name); \
    static bool hit = false; \
    if (ROS_UNLIKELY(enabled) && ROS_UNLIKELY(!hit)) \
    { \
      hit = true; \
      ROSCONSOLE_PRINT_STREAM_AT_LOCATION(args); \
    } \
  } while(0)

Log to a given named logger at a given verbosity level, only the first time it is hit when enabled, with printf-style formatting.

Parameters:
level One of the levels specified in ros::console::levels::Level
name Name of the logger. Note that this is the fully qualified name, and does NOT include "ros.<package_name>". Use ROSCONSOLE_DEFAULT_NAME if you would like to use the default name.

Definition at line 383 of file console.h.

#define ROS_LOG_STREAM_THROTTLE ( rate,
level,
name,
args   ) 
Value:
do \
  { \
    ROSCONSOLE_DEFINE_LOCATION(true, level, name); \
    static double last_hit = 0.0; \
    ::ros::Time now = ::ros::Time::now(); \
    if (ROS_UNLIKELY(enabled) && ROS_UNLIKELY(last_hit + rate <= now.toSec())) \
    { \
      last_hit = now.toSec(); \
      ROSCONSOLE_PRINT_STREAM_AT_LOCATION(args); \
    } \
  } while(0)

Log to a given named logger at a given verbosity level, limited to a specific rate of printing, with printf-style formatting.

Parameters:
level One of the levels specified in ros::console::levels::Level
name Name of the logger. Note that this is the fully qualified name, and does NOT include "ros.<package_name>". Use ROSCONSOLE_DEFAULT_NAME if you would like to use the default name.
rate The rate it should actually trigger at

Definition at line 422 of file console.h.

#define ROS_LOG_THROTTLE ( rate,
level,
name,
...   ) 
Value:
do \
  { \
    ROSCONSOLE_DEFINE_LOCATION(true, level, name); \
    static double last_hit = 0.0; \
    ::ros::Time now = ::ros::Time::now(); \
    if (ROS_UNLIKELY(enabled) && ROS_UNLIKELY(last_hit + rate <= now.toSec())) \
    { \
      last_hit = now.toSec(); \
      ROSCONSOLE_PRINT_AT_LOCATION(__VA_ARGS__); \
    } \
  } while(0)

Log to a given named logger at a given verbosity level, limited to a specific rate of printing, with printf-style formatting.

Parameters:
level One of the levels specified in ros::console::levels::Level
name Name of the logger. Note that this is the fully qualified name, and does NOT include "ros.<package_name>". Use ROSCONSOLE_DEFAULT_NAME if you would like to use the default name.
rate The rate it should actually trigger at

Definition at line 402 of file console.h.

#define ROS_UNLIKELY (  )     __builtin_expect((x),0)

Definition at line 237 of file console.h.

#define ROSCONSOLE_AUTOINIT
Value:
do \
  { \
    if (ROS_UNLIKELY(!::ros::console::g_initialized)) \
    { \
      ::ros::console::initialize(); \
    } \
  } while(0)

Initializes the rosconsole library. Usually unnecessary to call directly.

Definition at line 280 of file console.h.

#define ROSCONSOLE_DEFAULT_NAME   ROSCONSOLE_NAME_PREFIX

Definition at line 257 of file console.h.

#define ROSCONSOLE_DEFINE_LOCATION ( cond,
level,
name   ) 
Value:
ROSCONSOLE_AUTOINIT; \
  static ::ros::console::LogLocation loc = {false, false, ::ros::console::levels::Count, 0}; /* Initialized at compile-time */ \
  if (ROS_UNLIKELY(!loc.initialized_)) \
  { \
    initializeLogLocation(&loc, name, level); \
  } \
  if (ROS_UNLIKELY(loc.level_ != level)) \
  { \
    setLogLocationLevel(&loc, level); \
    checkLogLocationEnabled(&loc); \
  } \
  bool enabled = loc.logger_enabled_ && (cond);

Definition at line 289 of file console.h.

#define ROSCONSOLE_MIN_SEVERITY   ROSCONSOLE_SEVERITY_DEBUG

Define ROSCONSOLE_MIN_SEVERITY=ROSCONSOLE_SEVERITY_[DEBUG|INFO|WARN|ERROR|FATAL] in your build options to compile out anything below that severity

Definition at line 273 of file console.h.

#define ROSCONSOLE_NAME_PREFIX   ROSCONSOLE_ROOT_LOGGER_NAME "." ROSCONSOLE_PACKAGE_NAME

Definition at line 256 of file console.h.

#define ROSCONSOLE_PACKAGE_NAME   "unknown_package"

Definition at line 252 of file console.h.

#define ROSCONSOLE_PRINT_AT_LOCATION ( ...   )     ROSCONSOLE_PRINT_AT_LOCATION_WITH_FILTER(0, __VA_ARGS__)

Definition at line 306 of file console.h.

#define ROSCONSOLE_PRINT_AT_LOCATION_WITH_FILTER ( filter,
...   )     ::ros::console::print(filter, loc.logger_, loc.level_, __FILE__, __LINE__, __ROSCONSOLE_FUNCTION__, __VA_ARGS__)

Definition at line 303 of file console.h.

#define ROSCONSOLE_PRINT_STREAM_AT_LOCATION ( args   )     ROSCONSOLE_PRINT_STREAM_AT_LOCATION_WITH_FILTER(0, args)

Definition at line 317 of file console.h.

#define ROSCONSOLE_PRINT_STREAM_AT_LOCATION_WITH_FILTER ( filter,
args   ) 
Value:
do \
  { \
    std::stringstream ss; \
    ss << args; \
    ::ros::console::print(filter, loc.logger_, loc.level_, ss, __FILE__, __LINE__, __ROSCONSOLE_FUNCTION__); \
  } while (0)

Definition at line 309 of file console.h.

#define ROSCONSOLE_PRINTF_ATTRIBUTE ( a,
 ) 

Definition at line 50 of file console.h.

#define ROSCONSOLE_ROOT_LOGGER_NAME   "ros"

Definition at line 255 of file console.h.

#define ROSCONSOLE_SEVERITY_DEBUG   0

Definition at line 260 of file console.h.

#define ROSCONSOLE_SEVERITY_ERROR   3

Definition at line 263 of file console.h.

#define ROSCONSOLE_SEVERITY_FATAL   4

Definition at line 264 of file console.h.

#define ROSCONSOLE_SEVERITY_INFO   1

Definition at line 261 of file console.h.

#define ROSCONSOLE_SEVERITY_NONE   5

Definition at line 265 of file console.h.

#define ROSCONSOLE_SEVERITY_WARN   2

Definition at line 262 of file console.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


rosconsole
Author(s): Josh Faust
autogenerated on Fri Jan 11 09:09:23 2013