log: Added support for theme.colors.debug

This commit is contained in:
Paul Beckingham 2016-06-07 23:17:08 -04:00
parent f8245c1552
commit 5a115993ee
3 changed files with 14 additions and 3 deletions

View file

@ -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)
{

View file

@ -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";
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -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