mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
log: Added debug function
This commit is contained in:
parent
2e1bdce38b
commit
ebf1e2c521
3 changed files with 54 additions and 0 deletions
|
@ -17,6 +17,7 @@ set (timew_SRCS CLI.cpp CLI.h
|
||||||
data.cpp
|
data.cpp
|
||||||
init.cpp
|
init.cpp
|
||||||
helper.cpp
|
helper.cpp
|
||||||
|
log.cpp
|
||||||
util.cpp)
|
util.cpp)
|
||||||
|
|
||||||
set (libshared_SRCS libshared/src/Args.cpp libshared/src/Args.h
|
set (libshared_SRCS libshared/src/Args.cpp libshared/src/Args.h
|
||||||
|
|
47
src/log.cpp
Normal file
47
src/log.cpp
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright 2015 - 2016, Paul Beckingham, Federico Hernandez.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included
|
||||||
|
// in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
//
|
||||||
|
// http://www.opensource.org/licenses/mit-license.php
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <cmake.h>
|
||||||
|
#include <Color.h>
|
||||||
|
#include <timew.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
static bool debugMode = false;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void enableDebugMode (bool value)
|
||||||
|
{
|
||||||
|
debugMode = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void debug (const std::string& msg)
|
||||||
|
{
|
||||||
|
if (debugMode)
|
||||||
|
std::cout << Color ("gray4").colorize (msg) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
|
@ -72,6 +72,12 @@ std::map <std::string, Color> createTagColorMap (const Rules&, Palette&, const s
|
||||||
int quantizeTo15Minutes (const int);
|
int quantizeTo15Minutes (const int);
|
||||||
bool dayIsHoliday (const Rules&, const Datetime&);
|
bool dayIsHoliday (const Rules&, const Datetime&);
|
||||||
|
|
||||||
|
// log.cpp
|
||||||
|
void enableDebugMode (bool);
|
||||||
|
void enableQuietMode (bool);
|
||||||
|
void debug (const std::string&);
|
||||||
|
void error (const std::string&);
|
||||||
|
|
||||||
// utiŀ.cpp
|
// utiŀ.cpp
|
||||||
std::string osName ();
|
std::string osName ();
|
||||||
std::string escape (const std::string&, int);
|
std::string escape (const std::string&, int);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue