summaryrefslogtreecommitdiff
path: root/src/utils.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-19 16:23:17 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-19 16:23:17 -0400
commit0ec53e4a6cfa37f4de3e2e696bb1e8aeabfc8386 (patch)
tree9bdb974198cf86757fecce030ec9f15b83d8024c /src/utils.cc
parent8a051119accaf1088cce7db9ff9f8944dbc40b65 (diff)
downloadfork-ledger-0ec53e4a6cfa37f4de3e2e696bb1e8aeabfc8386.tar.gz
fork-ledger-0ec53e4a6cfa37f4de3e2e696bb1e8aeabfc8386.tar.bz2
fork-ledger-0ec53e4a6cfa37f4de3e2e696bb1e8aeabfc8386.zip
Allow the environment variable LEDGER_DEBUG to enable debugging.
Diffstat (limited to 'src/utils.cc')
-rw-r--r--src/utils.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils.cc b/src/utils.cc
index 8f296341..3e758449 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -520,6 +520,16 @@ namespace ledger {
optional<std::string> _log_category;
+struct __maybe_enable_debugging {
+ __maybe_enable_debugging() {
+ const char * p = std::getenv("LEDGER_DEBUG");
+ if (p != NULL) {
+ _log_level = LOG_DEBUG;
+ _log_category = p;
+ }
+ }
+} __maybe_enable_debugging_obj;
+
} // namespace ledger
#endif // DEBUG_ON