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)
|
||||
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.
|
||||
database.initialize (data._data);
|
||||
|
||||
|
|
13
src/log.cpp
13
src/log.cpp
|
@ -30,6 +30,7 @@
|
|||
#include <iostream>
|
||||
|
||||
static bool debugMode = false;
|
||||
static std::string debugIndicator = ">>";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
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)
|
||||
std::cout << Color ("gray4").colorize (">> " + msg) << "\n";
|
||||
debugIndicator = indicator;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
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
|
||||
void enableDebugMode (bool);
|
||||
void enableQuietMode (bool);
|
||||
void setDebugIndicator (const std::string&);
|
||||
void debug (const std::string&);
|
||||
void error (const std::string&);
|
||||
|
||||
// utiŀ.cpp
|
||||
std::string osName ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue