libfoedus-core
FOEDUS Core Library
debugging_options.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015, Hewlett-Packard Development Company, LP.
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the Free
5  * Software Foundation; either version 2 of the License, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11  * more details. You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * HP designates this particular file as subject to the "Classpath" exception
16  * as provided by HP in the LICENSE.txt file that accompanied this code.
17  */
20 namespace foedus {
21 namespace debugging {
23  debug_log_to_stderr_(false),
24  debug_log_stderr_threshold_(kDebugLogInfo),
25  debug_log_min_threshold_(kDebugLogInfo),
26  verbose_log_level_(0),
27  verbose_modules_(""),
28  debug_log_dir_("/tmp/") {
29 }
30 
31 ErrorStack DebuggingOptions::load(tinyxml2::XMLElement* element) {
38  return kRetOk;
39 }
40 
41 ErrorStack DebuggingOptions::save(tinyxml2::XMLElement* element) const {
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 }
76 
77 } // namespace debugging
78 } // namespace foedus
#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.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
DebuggingOptions()
Constructs option values with default values.
assorted::FixedString< 252 > verbose_modules_
Per-module verbose level.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
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.
ErrorStack save(tinyxml2::XMLElement *element) const override
Writes the content of this object to the given XML element.
#define EXTERNALIZE_LOAD_ENUM_ELEMENT(element, attribute)
Reads a child xml element to load a member variable of this object.
ErrorStack load(tinyxml2::XMLElement *element) override
Reads the content of this object from the given XML element.
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.