GNU Radio Manual and C++ API Reference  3.7.4
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
logger.h File Reference
#include <gnuradio/api.h>
#include <assert.h>
#include <iostream>
#include <time.h>
#include <boost/filesystem.hpp>
#include <boost/thread.hpp>
#include <boost/format.hpp>
#include <pmt/pmt.h>
Include dependency graph for logger.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  gr::logger
 Logger class for referencing loggers in python. Not needed in C++ (use macros) Wraps and manipulates loggers for python as python has no macros. More...
 

Namespaces

 gr
 Include this header to use the message passing features.
 

Macros

#define ENABLE_GR_LOG
 GNU Radio logging wrapper for log4cpp library (C++ port of log4j) More...
 
#define GR_LOG_DECLARE_LOGPTR(logger)
 
#define GR_LOG_ASSIGN_LOGPTR(logger, name)
 
#define GR_CONFIG_LOGGER(config)
 
#define GR_CONFIG_AND_WATCH_LOGGER(config, period)
 
#define GR_LOG_GETLOGGER(logger, name)
 
#define GR_SET_LEVEL(name, level)
 
#define GR_LOG_SET_LEVEL(logger, level)
 
#define GR_GET_LEVEL(name, level)
 
#define GR_LOG_GET_LEVEL(logger, level)
 
#define GR_ADD_APPENDER(name, appender)
 
#define GR_LOG_ADD_APPENDER(logger, appender)
 
#define GR_SET_APPENDER(name, appender)
 
#define GR_LOG_SET_APPENDER(logger, appender)
 
#define GR_ADD_CONSOLE_APPENDER(logger, target, pattern)
 
#define GR_LOG_ADD_CONSOLE_APPENDER(logger, target, pattern)
 
#define GR_SET_CONSOLE_APPENDER(logger, target, pattern)
 
#define GR_LOG_SET_CONSOLE_APPENDER(logger, target, pattern)
 
#define GR_ADD_FILE_APPENDER(name, filename, append, pattern)
 
#define GR_LOG_ADD_FILE_APPENDER(logger, filename, append, pattern)
 
#define GR_SET_FILE_APPENDER(name, filename, append, pattern)
 
#define GR_LOG_SET_FILE_APPENDER(logger, filename, append, pattern)
 
#define GR_ADD_ROLLINGFILE_APPENDER(name, filename, filesize, bkup_index, append, mode, pattern)
 
#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger, filename, filesize, bkup_index, append, mode, pattern)
 
#define GR_GET_LOGGER_NAMES(names)
 
#define GR_RESET_CONFIGURATION()
 
#define GR_DEBUG(name, msg)   std::cout<<"DEBUG: "<<msg<<std::endl
 
#define GR_INFO(name, msg)   std::cout<<"INFO: "<<msg<<std::endl
 
#define GR_NOTICE(name, msg)   std::cout<<"NOTICE: "<<msg<<std::endl
 
#define GR_WARN(name, msg)   std::cerr<<"WARN: "<<msg<<std::endl
 
#define GR_ERROR(name, msg)   std::cerr<<"ERROR: "<<msg<<std::endl
 
#define GR_ALERT(name, msg)   std::cerr<<"ERROR: "<<msg<<std::endl
 
#define GR_CRIT(name, msg)   std::cerr<<"ERROR: "<<msg<<std::endl
 
#define GR_FATAL(name, msg)   std::cerr<<"FATAL: "<<msg<<std::endl
 
#define GR_EMERG(name, msg)   std::cerr<<"EMERG: "<<msg<<std::endl
 
#define GR_ERRORIF(name, cond, msg)   {if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl;}
 
#define GR_ASSERT(name, cond, msg)   {if(!(cond)) std::cerr<<"FATAL: "<<msg<<std::endl; assert(cond);}
 
#define GR_LOG_DEBUG(logger, msg)   std::cout<<"DEBUG: "<<msg<<std::endl
 
#define GR_LOG_INFO(logger, msg)   std::cout<<"INFO: "<<msg<<std::endl
 
#define GR_LOG_NOTICE(logger, msg)   std::cout<<"NOTICE: "<<msg<<std::endl
 
#define GR_LOG_WARN(logger, msg)   std::cerr<<"WARN: "<<msg<<std::endl
 
#define GR_LOG_ERROR(logger, msg)   std::cerr<<"ERROR: "<<msg<<std::endl
 
#define GR_LOG_ALERT(logger, msg)   std::cerr<<"ALERT: "<<msg<<std::endl
 
#define GR_LOG_CRIT(logger, msg)   std::cerr<<"CRIT: "<<msg<<std::endl
 
#define GR_LOG_FATAL(logger, msg)   std::cerr<<"FATAL: "<<msg<<std::endl
 
#define GR_LOG_EMERG(logger, msg)   std::cerr<<"EMERG: "<<msg<<std::endl
 
#define GR_LOG_ERRORIF(logger, cond, msg)
 
#define GR_LOG_ASSERT(logger, cond, msg)
 

Typedefs

typedef std::string gr::logger_ptr
 

Functions

GR_RUNTIME_API void gr_logger_config (const std::string config_filename, unsigned int watch_period=0)
 Function to call configuration macro from python. Note: Configuration is only updated if filename or watch_period has changed. More...
 
GR_RUNTIME_API std::vector
< std::string > 
gr_logger_get_logger_names (void)
 Function to return logger names to python. More...
 
GR_RUNTIME_API void gr_logger_reset_config (void)
 Function to reset logger configuration from python. More...
 

Macro Definition Documentation

#define ENABLE_GR_LOG

GNU Radio logging wrapper for log4cpp library (C++ port of log4j)

#define GR_ADD_APPENDER (   name,
  appender 
)
#define GR_ADD_CONSOLE_APPENDER (   logger,
  target,
  pattern 
)
#define GR_ADD_FILE_APPENDER (   name,
  filename,
  append,
  pattern 
)
#define GR_ADD_ROLLINGFILE_APPENDER (   name,
  filename,
  filesize,
  bkup_index,
  append,
  mode,
  pattern 
)
#define GR_ALERT (   name,
  msg 
)    std::cerr<<"ERROR: "<<msg<<std::endl
#define GR_ASSERT (   name,
  cond,
  msg 
)    {if(!(cond)) std::cerr<<"FATAL: "<<msg<<std::endl; assert(cond);}
#define GR_CONFIG_AND_WATCH_LOGGER (   config,
  period 
)
#define GR_CONFIG_LOGGER (   config)
#define GR_CRIT (   name,
  msg 
)    std::cerr<<"ERROR: "<<msg<<std::endl
#define GR_DEBUG (   name,
  msg 
)    std::cout<<"DEBUG: "<<msg<<std::endl
#define GR_EMERG (   name,
  msg 
)    std::cerr<<"EMERG: "<<msg<<std::endl
#define GR_ERROR (   name,
  msg 
)    std::cerr<<"ERROR: "<<msg<<std::endl
#define GR_ERRORIF (   name,
  cond,
  msg 
)    {if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl;}
#define GR_FATAL (   name,
  msg 
)    std::cerr<<"FATAL: "<<msg<<std::endl
#define GR_GET_LEVEL (   name,
  level 
)
#define GR_GET_LOGGER_NAMES (   names)
#define GR_INFO (   name,
  msg 
)    std::cout<<"INFO: "<<msg<<std::endl
#define GR_LOG_ADD_APPENDER (   logger,
  appender 
)
#define GR_LOG_ADD_CONSOLE_APPENDER (   logger,
  target,
  pattern 
)
#define GR_LOG_ADD_FILE_APPENDER (   logger,
  filename,
  append,
  pattern 
)
#define GR_LOG_ADD_ROLLINGFILE_APPENDER (   logger,
  filename,
  filesize,
  bkup_index,
  append,
  mode,
  pattern 
)
#define GR_LOG_ALERT (   logger,
  msg 
)    std::cerr<<"ALERT: "<<msg<<std::endl

Referenced by gr::logger::alert().

#define GR_LOG_ASSERT (   logger,
  cond,
  msg 
)
Value:
{ \
if(!(cond)) {std::cerr<<"FATAL: "<<msg<<std::endl; assert(cond);};}

Referenced by gr::logger::log_assert().

#define GR_LOG_ASSIGN_LOGPTR (   logger,
  name 
)

Referenced by gr::logger::logger().

#define GR_LOG_CRIT (   logger,
  msg 
)    std::cerr<<"CRIT: "<<msg<<std::endl

Referenced by gr::logger::crit().

#define GR_LOG_DEBUG (   logger,
  msg 
)    std::cout<<"DEBUG: "<<msg<<std::endl

Referenced by gr::logger::debug().

#define GR_LOG_DECLARE_LOGPTR (   logger)
#define GR_LOG_EMERG (   logger,
  msg 
)    std::cerr<<"EMERG: "<<msg<<std::endl

Referenced by gr::logger::emerg().

#define GR_LOG_ERROR (   logger,
  msg 
)    std::cerr<<"ERROR: "<<msg<<std::endl

Referenced by gr::logger::error().

#define GR_LOG_ERRORIF (   logger,
  cond,
  msg 
)
Value:
{ \
if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl;}

Referenced by gr::logger::errorIF().

#define GR_LOG_FATAL (   logger,
  msg 
)    std::cerr<<"FATAL: "<<msg<<std::endl

Referenced by gr::logger::fatal().

#define GR_LOG_GET_LEVEL (   logger,
  level 
)

Referenced by gr::logger::get_level().

#define GR_LOG_GETLOGGER (   logger,
  name 
)
#define GR_LOG_INFO (   logger,
  msg 
)    std::cout<<"INFO: "<<msg<<std::endl

Referenced by gr::logger::info().

#define GR_LOG_NOTICE (   logger,
  msg 
)    std::cout<<"NOTICE: "<<msg<<std::endl

Referenced by gr::logger::notice().

#define GR_LOG_SET_APPENDER (   logger,
  appender 
)
#define GR_LOG_SET_CONSOLE_APPENDER (   logger,
  target,
  pattern 
)
#define GR_LOG_SET_FILE_APPENDER (   logger,
  filename,
  append,
  pattern 
)
#define GR_LOG_SET_LEVEL (   logger,
  level 
)

Referenced by gr::logger::set_level().

#define GR_LOG_WARN (   logger,
  msg 
)    std::cerr<<"WARN: "<<msg<<std::endl

Referenced by gr::logger::warn().

#define GR_NOTICE (   name,
  msg 
)    std::cout<<"NOTICE: "<<msg<<std::endl
#define GR_RESET_CONFIGURATION ( )
#define GR_SET_APPENDER (   name,
  appender 
)
#define GR_SET_CONSOLE_APPENDER (   logger,
  target,
  pattern 
)
#define GR_SET_FILE_APPENDER (   name,
  filename,
  append,
  pattern 
)
#define GR_SET_LEVEL (   name,
  level 
)
#define GR_WARN (   name,
  msg 
)    std::cerr<<"WARN: "<<msg<<std::endl

Function Documentation

GR_RUNTIME_API void gr_logger_config ( const std::string  config_filename,
unsigned int  watch_period = 0 
)

Function to call configuration macro from python. Note: Configuration is only updated if filename or watch_period has changed.

Parameters
config_filenameName of configuration file
watch_periodSeconds to wait between checking for changes in conf file. Watch_period defaults to 0 in which case the file is not watched for changes
GR_RUNTIME_API std::vector<std::string> gr_logger_get_logger_names ( void  )

Function to return logger names to python.

Returns
Vector of name strings
GR_RUNTIME_API void gr_logger_reset_config ( void  )

Function to reset logger configuration from python.