#include <sys/types.h>
#include <gnuradio/api.h>
#include <assert.h>
#include <log4cpp/Category.hh>
#include <log4cpp/FileAppender.hh>
#include <log4cpp/OstreamAppender.hh>
#include <log4cpp/PatternLayout.hh>
#include <log4cpp/PropertyConfigurator.hh>
#include <log4cpp/RollingFileAppender.hh>
#include <pmt/pmt.h>
#include <time.h>
#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include <boost/thread.hpp>
#include <iostream>
Go to the source code of this file.
Classes | |
class | gr::logger_config |
Class to control configuration of logger. This is a singleton that can launch a thread to watch a config file for changes. More... | |
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 | |
GNU Radio logging wrapper for log4cpp library (C++ port of log4j) | |
Macros | |
#define | GR_LOG_DECLARE_LOGPTR(logger) gr::logger_ptr logger |
#define | GR_LOG_ASSIGN_LOGPTR(logger, name) logger = gr::logger_get_logger(name) |
#define | GR_CONFIG_LOGGER(config) gr::logger_config::load_config(config) |
#define | GR_CONFIG_AND_WATCH_LOGGER(config, period) gr::logger_config::load_config(config, period) |
#define | GR_LOG_GETLOGGER(logger, name) gr::logger_ptr logger = gr::logger_get_logger(name) |
#define | GR_SET_LEVEL(name, level) |
#define | GR_LOG_SET_LEVEL(logger, level) gr::logger_set_level(logger, level) |
#define | GR_GET_LEVEL(name, level) |
#define | GR_LOG_GET_LEVEL(logger, level) gr::logger_get_level(logger, level) |
#define | GR_ADD_CONSOLE_APPENDER(name, target, pattern) |
#define | GR_LOG_ADD_CONSOLE_APPENDER(logger, target, pattern) |
#define | GR_SET_CONSOLE_APPENDER(name, 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() gr::logger_config::reset_config(); |
#define | GR_DEBUG(name, msg) |
#define | GR_INFO(name, msg) |
#define | GR_NOTICE(name, msg) |
#define | GR_WARN(name, msg) |
#define | GR_ERROR(name, msg) |
#define | GR_CRIT(name, msg) |
#define | GR_ALERT(name, msg) |
#define | GR_FATAL(name, msg) |
#define | GR_EMERG(name, msg) |
#define | GR_ERRORIF(name, cond, msg) |
#define | GR_ASSERT(name, cond, msg) |
#define | GR_LOG_DEBUG(logger, msg) |
#define | GR_LOG_INFO(logger, msg) |
#define | GR_LOG_NOTICE(logger, msg) |
#define | GR_LOG_WARN(logger, msg) |
#define | GR_LOG_ERROR(logger, msg) |
#define | GR_LOG_CRIT(logger, msg) |
#define | GR_LOG_ALERT(logger, msg) |
#define | GR_LOG_FATAL(logger, msg) |
#define | GR_LOG_EMERG(logger, msg) |
#define | GR_LOG_ERRORIF(logger, cond, msg) |
#define | GR_LOG_ASSERT(logger, cond, msg) |
Typedefs | |
typedef log4cpp::Category * | gr::logger_ptr |
GR_LOG macrosThese macros wrap the standard LOG4CPP_LEVEL macros. The availablie macros are: LOG_DEBUG LOG_INFO LOG_WARN LOG_TRACE LOG_ERROR LOG_ALERT LOG_CRIT LOG_FATAL LOG_EMERG. More... | |
Functions | |
GR_RUNTIME_API logger_ptr | gr::logger_get_logger (std::string name) |
Retrieve a pointer to a logger by name. More... | |
GR_RUNTIME_API bool | gr::logger_load_config (const std::string &config_filename="") |
Load logger's configuration file. More... | |
GR_RUNTIME_API void | gr::logger_reset_config (void) |
Reset logger's configuration file. More... | |
GR_RUNTIME_API void | gr::logger_set_level (logger_ptr logger, const std::string &level) |
Set the logger's output level. More... | |
GR_RUNTIME_API void | gr::logger_set_level (logger_ptr logger, log4cpp::Priority::Value level) |
Set the logger's output level. More... | |
GR_RUNTIME_API void | gr::logger_get_level (logger_ptr logger, std::string &level) |
Get the logger's output level. More... | |
GR_RUNTIME_API void | gr::logger_get_level (logger_ptr logger, log4cpp::Priority::Value &level) |
Get the logger's output level. More... | |
GR_RUNTIME_API void | gr::logger_add_appender (logger_ptr logger, std::string appender) |
Add console appender to a given logger. More... | |
GR_RUNTIME_API void | gr::logger_set_appender (logger_ptr logger, std::string appender) |
Sets a console appender to a given logger. Deletes any existing appenders and adds a new one. To add an additional appender, use logger_add_appender. More... | |
GR_RUNTIME_API void | gr::logger_add_console_appender (logger_ptr logger, std::string target, std::string pattern) |
Add console appender to a given logger. More... | |
GR_RUNTIME_API void | gr::logger_set_console_appender (logger_ptr logger, std::string target, std::string pattern) |
Sets a new console appender to a given logger after removing all others. Use logger_add_console_appender to add another. More... | |
GR_RUNTIME_API void | gr::logger_add_file_appender (logger_ptr logger, std::string filename, bool append, std::string pattern) |
Add file appender to a given logger. More... | |
GR_RUNTIME_API void | gr::logger_set_file_appender (logger_ptr logger, std::string filename, bool append, std::string pattern) |
Set a file appender to a given logger. To add another file appender, use logger_add_file_appender. More... | |
GR_RUNTIME_API void | gr::logger_add_rollingfile_appender (logger_ptr logger, std::string filename, size_t filesize, int bkup_index, bool append, mode_t mode, std::string pattern) |
Add rolling file appender to a given logger. More... | |
GR_RUNTIME_API std::vector< std::string > | gr::logger_get_logger_names (void) |
Add rolling file appender to a given logger. More... | |
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... | |
GR_RUNTIME_API bool | gr::configure_default_loggers (gr::logger_ptr &l, gr::logger_ptr &d, const std::string name) |
GR_RUNTIME_API bool | gr::update_logger_alias (const std::string &name, const std::string &alias) |
#define GR_ADD_CONSOLE_APPENDER | ( | name, | |
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 | |||
) |
#define GR_ASSERT | ( | name, | |
cond, | |||
msg | |||
) |
#define GR_CONFIG_AND_WATCH_LOGGER | ( | config, | |
period | |||
) | gr::logger_config::load_config(config, period) |
#define GR_CONFIG_LOGGER | ( | config | ) | gr::logger_config::load_config(config) |
#define GR_CRIT | ( | name, | |
msg | |||
) |
#define GR_DEBUG | ( | name, | |
msg | |||
) |
#define GR_EMERG | ( | name, | |
msg | |||
) |
#define GR_ERROR | ( | name, | |
msg | |||
) |
#define GR_ERRORIF | ( | name, | |
cond, | |||
msg | |||
) |
#define GR_FATAL | ( | name, | |
msg | |||
) |
#define GR_GET_LEVEL | ( | name, | |
level | |||
) |
#define GR_GET_LOGGER_NAMES | ( | names | ) |
#define GR_INFO | ( | name, | |
msg | |||
) |
#define GR_LOG_ADD_CONSOLE_APPENDER | ( | logger, | |
target, | |||
pattern | |||
) |
Referenced by gr::logger::add_console_appender().
#define GR_LOG_ADD_FILE_APPENDER | ( | logger, | |
filename, | |||
append, | |||
pattern | |||
) |
Referenced by gr::logger::add_file_appender().
#define GR_LOG_ADD_ROLLINGFILE_APPENDER | ( | logger, | |
filename, | |||
filesize, | |||
bkup_index, | |||
append, | |||
mode, | |||
pattern | |||
) |
Referenced by gr::logger::add_rollingfile_appender().
#define GR_LOG_ALERT | ( | logger, | |
msg | |||
) |
Referenced by gr::logger::alert().
#define GR_LOG_ASSERT | ( | logger, | |
cond, | |||
msg | |||
) |
Referenced by gr::logger::log_assert().
#define GR_LOG_ASSIGN_LOGPTR | ( | logger, | |
name | |||
) | logger = gr::logger_get_logger(name) |
Referenced by gr::logger::logger().
#define GR_LOG_CRIT | ( | logger, | |
msg | |||
) |
Referenced by gr::logger::crit().
#define GR_LOG_DEBUG | ( | logger, | |
msg | |||
) |
Referenced by gr::logger::debug().
#define GR_LOG_DECLARE_LOGPTR | ( | logger | ) | gr::logger_ptr logger |
#define GR_LOG_EMERG | ( | logger, | |
msg | |||
) |
Referenced by gr::logger::emerg().
#define GR_LOG_ERROR | ( | logger, | |
msg | |||
) |
Referenced by gr::logger::error().
#define GR_LOG_ERRORIF | ( | logger, | |
cond, | |||
msg | |||
) |
Referenced by gr::logger::errorIF().
#define GR_LOG_FATAL | ( | logger, | |
msg | |||
) |
Referenced by gr::logger::fatal().
#define GR_LOG_GET_LEVEL | ( | logger, | |
level | |||
) | gr::logger_get_level(logger, level) |
Referenced by gr::logger::get_level().
#define GR_LOG_GETLOGGER | ( | logger, | |
name | |||
) | gr::logger_ptr logger = gr::logger_get_logger(name) |
#define GR_LOG_INFO | ( | logger, | |
msg | |||
) |
Referenced by gr::logger::info().
#define GR_LOG_NOTICE | ( | logger, | |
msg | |||
) |
Referenced by gr::logger::notice().
#define GR_LOG_SET_CONSOLE_APPENDER | ( | logger, | |
target, | |||
pattern | |||
) |
Referenced by gr::logger::set_console_appender().
#define GR_LOG_SET_FILE_APPENDER | ( | logger, | |
filename, | |||
append, | |||
pattern | |||
) |
Referenced by gr::logger::set_file_appender().
#define GR_LOG_SET_LEVEL | ( | logger, | |
level | |||
) | gr::logger_set_level(logger, level) |
Referenced by gr::logger::set_level().
#define GR_LOG_WARN | ( | logger, | |
msg | |||
) |
Referenced by gr::logger::warn().
#define GR_NOTICE | ( | name, | |
msg | |||
) |
#define GR_RESET_CONFIGURATION | ( | ) | gr::logger_config::reset_config(); |
#define GR_SET_CONSOLE_APPENDER | ( | name, | |
target, | |||
pattern | |||
) |
#define GR_SET_FILE_APPENDER | ( | name, | |
filename, | |||
append, | |||
pattern | |||
) |
#define GR_SET_LEVEL | ( | name, | |
level | |||
) |
#define GR_WARN | ( | name, | |
msg | |||
) |
Referenced by thrift_application_base< TserverBase, TImplClass >::thrift_application_base().
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.
config_filename | Name of configuration file |
watch_period | Seconds to wait between checking for changes in conf file. Watch_period defaults to 0 in which case the file is not watched for changes |
Referenced by gr::logger::add_rollingfile_appender().
GR_RUNTIME_API std::vector<std::string> gr_logger_get_logger_names | ( | void | ) |
Function to return logger names to python.
Referenced by gr::logger::add_rollingfile_appender().
GR_RUNTIME_API void gr_logger_reset_config | ( | void | ) |
Function to reset logger configuration from python.
Referenced by gr::logger::add_rollingfile_appender().