libfoedus-core
FOEDUS Core Library
foedus::debugging::DebuggingOptions Struct Referencefinal

Set of options for debugging support. More...

Detailed Description

Set of options for debugging support.

This is a POD struct. Default destructor/copy-constructor/assignment operator work fine. For ease of debugging, some of the options here has corresponding APIs to change at runtime. So, those options are merely initial configurations.

Definition at line 38 of file debugging_options.hpp.

#include <debugging_options.hpp>

Inheritance diagram for foedus::debugging::DebuggingOptions:
Collaboration diagram for foedus::debugging::DebuggingOptions:

Public Types

enum  DebugLogLevel { kDebugLogInfo = 0, kDebugLogWarning, kDebugLogError, kDebugLogFatal }
 Defines debug logging levels. More...
 

Public Member Functions

 DebuggingOptions ()
 Constructs option values with default values. More...
 
ErrorStack load (tinyxml2::XMLElement *element) override
 Reads the content of this object from the given XML element. More...
 
ErrorStack save (tinyxml2::XMLElement *element) const override
 Writes the content of this object to the given XML element. More...
 
const char * get_tag_name () const override
 Returns an XML tag name for this object as a root element. More...
 
void assign (const foedus::externalize::Externalizable *other) override
 Polymorphic assign operator. More...
 
- Public Member Functions inherited from foedus::externalize::Externalizable
ErrorStack load_from_string (const std::string &xml)
 Load the content of this object from the given XML string. More...
 
void save_to_stream (std::ostream *ptr) const
 Invokes save() and directs the resulting XML text to the given stream. More...
 
ErrorStack load_from_file (const fs::Path &path)
 Load the content of this object from the specified XML file. More...
 
ErrorStack save_to_file (const fs::Path &path) const
 Atomically and durably writes out this object to the specified XML file. More...
 

Public Attributes

bool debug_log_to_stderr_
 Whether to write debug logs to stderr rather than log file. More...
 
DebugLogLevel debug_log_stderr_threshold_
 Debug logs at or above this level will be copied to stderr. More...
 
DebugLogLevel debug_log_min_threshold_
 Debug logs below this level will be completely ignored. More...
 
int16_t verbose_log_level_
 Verbose debug logs (VLOG(m)) at or less than this number will be shown. More...
 
assorted::FixedString< 252 > verbose_modules_
 Per-module verbose level. More...
 
fs::FixedPath debug_log_dir_
 Path of the folder to write debug logs. More...
 

Friends

std::ostream & operator<< (std::ostream &o, const DebuggingOptions &v)
 

Additional Inherited Members

- Static Public Member Functions inherited from foedus::externalize::Externalizable
static ErrorStack insert_comment (tinyxml2::XMLElement *element, const std::string &comment)
 
static ErrorStack append_comment (tinyxml2::XMLElement *parent, const std::string &comment)
 
static ErrorStack create_element (tinyxml2::XMLElement *parent, const std::string &name, tinyxml2::XMLElement **out)
 
template<typename T >
static ErrorStack add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, T value)
 Only declaration in header. More...
 
template<uint MAXLEN, typename CHAR >
static ErrorStack add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const assorted::FixedString< MAXLEN, CHAR > &value)
 
template<typename T >
static ErrorStack add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const std::vector< T > &value)
 vector version More...
 
template<typename ENUM >
static ErrorStack add_enum_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, ENUM value)
 enum version More...
 
static ErrorStack add_child_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const Externalizable &child)
 child Externalizable version More...
 
template<typename T >
static ErrorStack get_element (tinyxml2::XMLElement *parent, const std::string &tag, T *out, bool optional=false, T value=0)
 Only declaration in header. More...
 
static ErrorStack get_element (tinyxml2::XMLElement *parent, const std::string &tag, std::string *out, bool optional=false, const char *value="")
 string type is bit special. More...
 
template<uint MAXLEN, typename CHAR >
static ErrorStack get_element (tinyxml2::XMLElement *parent, const std::string &tag, assorted::FixedString< MAXLEN, CHAR > *out, bool optional=false, const assorted::FixedString< MAXLEN, CHAR > &value=assorted::FixedString< MAXLEN, CHAR >())
 
template<typename ENUM >
static ErrorStack get_enum_element (tinyxml2::XMLElement *parent, const std::string &tag, ENUM *out, bool optional=false, ENUM default_value=static_cast< ENUM >(0))
 enum version More...
 
template<typename T >
static ErrorStack get_element (tinyxml2::XMLElement *parent, const std::string &tag, std::vector< T > *out, bool optional=false)
 vector version. More...
 
static ErrorStack get_child_element (tinyxml2::XMLElement *parent, const std::string &tag, Externalizable *child, bool optional=false)
 child Externalizable version More...
 

Member Enumeration Documentation

Defines debug logging levels.

Enumerator
kDebugLogInfo 

Usual logs.

kDebugLogWarning 

Warns that there are something unexpected, but not a big issue.

kDebugLogError 

Raises a major issue.

kDebugLogFatal 

Immediately quits the engine after this log.

Definition at line 40 of file debugging_options.hpp.

40  {
42  kDebugLogInfo = 0,
49  };
Immediately quits the engine after this log.
Warns that there are something unexpected, but not a big issue.

Constructor & Destructor Documentation

foedus::debugging::DebuggingOptions::DebuggingOptions ( )

Constructs option values with default values.

Definition at line 22 of file debugging_options.cpp.

22  :
23  debug_log_to_stderr_(false),
27  verbose_modules_(""),
28  debug_log_dir_("/tmp/") {
29 }
bool debug_log_to_stderr_
Whether to write debug logs to stderr rather than log file.
assorted::FixedString< 252 > verbose_modules_
Per-module verbose level.
fs::FixedPath debug_log_dir_
Path of the folder to write debug logs.
DebugLogLevel debug_log_min_threshold_
Debug logs below this level will be completely ignored.
DebugLogLevel debug_log_stderr_threshold_
Debug logs at or above this level will be copied to stderr.
int16_t verbose_log_level_
Verbose debug logs (VLOG(m)) at or less than this number will be shown.

Member Function Documentation

void foedus::debugging::DebuggingOptions::assign ( const foedus::externalize::Externalizable other)
inlineoverridevirtual

Polymorphic assign operator.

This should invoke operator= of the derived class.

Parameters
[in]otherassigned value. It must be dynamic-castable to the assignee class.

Implements foedus::externalize::Externalizable.

Definition at line 104 of file debugging_options.hpp.

const char* foedus::debugging::DebuggingOptions::get_tag_name ( ) const
inlineoverridevirtual

Returns an XML tag name for this object as a root element.

We might want to give a different name for same externalizable objects, so this is used only when it is the root element of xml.

Implements foedus::externalize::Externalizable.

Definition at line 104 of file debugging_options.hpp.

ErrorStack foedus::debugging::DebuggingOptions::load ( tinyxml2::XMLElement *  element)
overridevirtual

Reads the content of this object from the given XML element.

Parameters
[in]elementthe XML element that represents this object

Expect errors due to missing-elements, out-of-range values, etc.

Implements foedus::externalize::Externalizable.

Definition at line 31 of file debugging_options.cpp.

References debug_log_dir_, debug_log_min_threshold_, debug_log_stderr_threshold_, debug_log_to_stderr_, EXTERNALIZE_LOAD_ELEMENT, EXTERNALIZE_LOAD_ENUM_ELEMENT, foedus::kRetOk, verbose_log_level_, and verbose_modules_.

31  {
38  return kRetOk;
39 }
#define EXTERNALIZE_LOAD_ELEMENT(element, attribute)
Reads a child xml element to load a member variable of this object.
bool debug_log_to_stderr_
Whether to write debug logs to stderr rather than log file.
assorted::FixedString< 252 > verbose_modules_
Per-module verbose level.
#define EXTERNALIZE_LOAD_ENUM_ELEMENT(element, attribute)
Reads a child xml element to load a member variable of this object.
fs::FixedPath debug_log_dir_
Path of the folder to write debug logs.
DebugLogLevel debug_log_min_threshold_
Debug logs below this level will be completely ignored.
const ErrorStack kRetOk
Normal return value for no-error case.
DebugLogLevel debug_log_stderr_threshold_
Debug logs at or above this level will be copied to stderr.
int16_t verbose_log_level_
Verbose debug logs (VLOG(m)) at or less than this number will be shown.
ErrorStack foedus::debugging::DebuggingOptions::save ( tinyxml2::XMLElement *  element) const
overridevirtual

Writes the content of this object to the given XML element.

Parameters
[in]elementthe XML element that represents this object

Expect only out-of-memory error. We receive the XML element this object will represent, so this method does not determine the XML element name of itself. The parent object determines children's tag names because one parent object might have multiple child objects of the same type with different XML element name.

Implements foedus::externalize::Externalizable.

Definition at line 41 of file debugging_options.cpp.

References CHECK_ERROR, debug_log_dir_, debug_log_min_threshold_, debug_log_stderr_threshold_, debug_log_to_stderr_, EXTERNALIZE_SAVE_ELEMENT, EXTERNALIZE_SAVE_ENUM_ELEMENT, foedus::externalize::Externalizable::insert_comment(), foedus::kRetOk, verbose_log_level_, and verbose_modules_.

41  {
42  CHECK_ERROR(insert_comment(element, "Set of options for debugging support.\n"
43  "For ease of debugging, some of the options here has corresponding APIs to change\n"
44  " at runtime. So, those options are merely initial configurations.\n"
45  " enum DebugLogLevel: Defines debug logging levels\n"
46  " kDebugLogInfo = 0: Usual logs\n"
47  " kDebugLogWarning = 1: Warns that there are something unexpected, but not a big issue.\n"
48  " kDebugLogError = 2: Raises a major issue.\n"
49  " kDebugLogFatal = 3: Immediately quits the engine after this log."));
50 
52  "Whether to write debug logs to stderr rather than log file.\n"
53  " Default is false. There is an API to change this setting at runtime.");
55  "Debug logs at or above this level will be copied to stderr.\n"
56  " Default is kDebugLogInfo. There is an API to change this setting at runtime.");
58  "Debug logs below this level will be completely ignored.\n"
59  " Default is kDebugLogInfo. There is an API to change this setting at runtime.");
61  "Verbose debug logs (VLOG(m)) at or less than this number will be shown.\n"
62  " Default is 0. There is an API to change this setting at runtime.");
64  "Per-module verbose level."
65  " The value has to contain a comma-separated list of\n"
66  " 'module name'='log level'. 'module name' is a glob pattern\n"
67  " (e.g., gfs* for all modules whose name starts with 'gfs'),\n"
68  " matched against the filename base (that is, name ignoring .cc/.h./-inl.h)\n"
69  " Default is '/'. There is an API to change this setting at runtime.");
71  "Path of the folder to write debug logs.\n"
72  " Default is '/tmp'. @attention We do NOT have API to change this setting at runtime.\n"
73  " You must configure this as a start-up option.");
74  return kRetOk;
75 }
bool debug_log_to_stderr_
Whether to write debug logs to stderr rather than log file.
assorted::FixedString< 252 > verbose_modules_
Per-module verbose level.
static ErrorStack insert_comment(tinyxml2::XMLElement *element, const std::string &comment)
#define EXTERNALIZE_SAVE_ENUM_ELEMENT(element, attribute, comment)
Adds an xml element to represent a member variable of this object.
fs::FixedPath debug_log_dir_
Path of the folder to write debug logs.
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
DebugLogLevel debug_log_min_threshold_
Debug logs below this level will be completely ignored.
const ErrorStack kRetOk
Normal return value for no-error case.
#define EXTERNALIZE_SAVE_ELEMENT(element, attribute, comment)
Adds an xml element to represent a member variable of this object.
DebugLogLevel debug_log_stderr_threshold_
Debug logs at or above this level will be copied to stderr.
int16_t verbose_log_level_
Verbose debug logs (VLOG(m)) at or less than this number will be shown.

Here is the call graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const DebuggingOptions v 
)
friend

Definition at line 104 of file debugging_options.hpp.

Member Data Documentation

fs::FixedPath foedus::debugging::DebuggingOptions::debug_log_dir_

Path of the folder to write debug logs.

Default is "/tmp".

Attention
We do NOT have API to change this setting at runtime. You must configure this as a start-up option.

Definition at line 102 of file debugging_options.hpp.

Referenced by load(), and save().

DebugLogLevel foedus::debugging::DebuggingOptions::debug_log_min_threshold_

Debug logs below this level will be completely ignored.

Default is kDebugLogInfo. There is an API to change this setting at runtime.

Definition at line 75 of file debugging_options.hpp.

Referenced by load(), and save().

DebugLogLevel foedus::debugging::DebuggingOptions::debug_log_stderr_threshold_

Debug logs at or above this level will be copied to stderr.

Default is kDebugLogInfo. There is an API to change this setting at runtime.

Definition at line 68 of file debugging_options.hpp.

Referenced by load(), and save().

bool foedus::debugging::DebuggingOptions::debug_log_to_stderr_

Whether to write debug logs to stderr rather than log file.

Default is false. There is an API to change this setting at runtime.

Definition at line 61 of file debugging_options.hpp.

Referenced by load(), and save().

int16_t foedus::debugging::DebuggingOptions::verbose_log_level_

Verbose debug logs (VLOG(m)) at or less than this number will be shown.

Default is 0. There is an API to change this setting at runtime.

Definition at line 82 of file debugging_options.hpp.

Referenced by load(), and save().

assorted::FixedString<252> foedus::debugging::DebuggingOptions::verbose_modules_

Per-module verbose level.

The value has to contain a comma-separated list of 'module name'='log level'. 'module name' is a glob pattern (e.g., gfs* for all modules whose name starts with "gfs"), matched against the filename base (that is, name ignoring .cc/.h./-inl.h) Default is "". There is an API to change this setting at runtime.

Definition at line 93 of file debugging_options.hpp.

Referenced by load(), and save().


The documentation for this struct was generated from the following files: