mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
log: Debugging prefix now configurable
This commit is contained in:
parent
d975631c9b
commit
3a0242e317
3 changed files with 14 additions and 5 deletions
|
@ -180,6 +180,9 @@ void initializeDataAndRules (
|
||||||
if (shinyNewDatabase)
|
if (shinyNewDatabase)
|
||||||
rules.set ("temp.shiny", 1);
|
rules.set ("temp.shiny", 1);
|
||||||
|
|
||||||
|
if (rules.has ("debug.indicator"))
|
||||||
|
setDebugIndicator (rules.get ("debug.indicator"));
|
||||||
|
|
||||||
// Initialize the database (no data read), but files are enumerated.
|
// Initialize the database (no data read), but files are enumerated.
|
||||||
database.initialize (data._data);
|
database.initialize (data._data);
|
||||||
|
|
||||||
|
|
13
src/log.cpp
13
src/log.cpp
|
@ -30,6 +30,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
static bool debugMode = false;
|
static bool debugMode = false;
|
||||||
|
static std::string debugIndicator = ">>";
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void enableDebugMode (bool value)
|
void enableDebugMode (bool value)
|
||||||
|
@ -38,10 +39,16 @@ void enableDebugMode (bool value)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void debug (const std::string& msg)
|
void setDebugIndicator (const std::string& indicator)
|
||||||
{
|
{
|
||||||
if (debugMode)
|
debugIndicator = indicator;
|
||||||
std::cout << Color ("gray4").colorize (">> " + msg) << "\n";
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void debug (const std::string& msg)
|
||||||
|
{
|
||||||
|
if (debugMode)
|
||||||
|
std::cout << Color ("gray4").colorize (debugIndicator + " " + msg) << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -74,9 +74,8 @@ bool dayIsHoliday (const Rules&, const Datetime&);
|
||||||
|
|
||||||
// log.cpp
|
// log.cpp
|
||||||
void enableDebugMode (bool);
|
void enableDebugMode (bool);
|
||||||
void enableQuietMode (bool);
|
void setDebugIndicator (const std::string&);
|
||||||
void debug (const std::string&);
|
void debug (const std::string&);
|
||||||
void error (const std::string&);
|
|
||||||
|
|
||||||
// utiŀ.cpp
|
// utiŀ.cpp
|
||||||
std::string osName ();
|
std::string osName ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue