mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
log: Added support for theme.colors.debug
This commit is contained in:
parent
f8245c1552
commit
5a115993ee
3 changed files with 14 additions and 3 deletions
|
@ -192,6 +192,9 @@ void initializeDataAndRules (
|
|||
if (rules.has ("debug.indicator"))
|
||||
setDebugIndicator (rules.get ("debug.indicator"));
|
||||
|
||||
if (rules.has ("theme.colors.debug"))
|
||||
setDebugColor (Color (rules.get ("theme.colors.debug")));
|
||||
|
||||
// Apply command line overrides.
|
||||
for (auto& arg : cli._args)
|
||||
{
|
||||
|
|
13
src/log.cpp
13
src/log.cpp
|
@ -31,6 +31,7 @@
|
|||
|
||||
static bool debugMode = false;
|
||||
static std::string debugIndicator = ">>";
|
||||
static Color debugColor;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void enableDebugMode (bool value)
|
||||
|
@ -45,10 +46,16 @@ void setDebugIndicator (const std::string& indicator)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void debug (const std::string& msg)
|
||||
void setDebugColor (const Color& color)
|
||||
{
|
||||
if (debugMode)
|
||||
std::cout << Color ("gray4").colorize (debugIndicator + " " + msg) << "\n";
|
||||
debugColor = color;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void debug (const std::string& msg)
|
||||
{
|
||||
if (debugMode)
|
||||
std::cout << debugColor.colorize (debugIndicator + " " + msg) << "\n";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -77,6 +77,7 @@ std::string minimalDelta (const Datetime&, const Datetime&);
|
|||
// log.cpp
|
||||
void enableDebugMode (bool);
|
||||
void setDebugIndicator (const std::string&);
|
||||
void setDebugColor (const Color&);
|
||||
void debug (const std::string&);
|
||||
|
||||
// utiŀ.cpp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue