diff options
author | David Robillard <d@drobilla.net> | 2016-09-18 04:42:31 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-09-18 04:42:31 -0400 |
commit | ce6dc3d549bc58515d5d55db1d0a009a92887f3c (patch) | |
tree | 2cde2929903e30ec6272a79bd0877dd435aa83c2 /src/Log.cpp | |
parent | 758543f6dbb56755d3239c0ed68f1083384f0e96 (diff) | |
download | ingen-ce6dc3d549bc58515d5d55db1d0a009a92887f3c.tar.gz ingen-ce6dc3d549bc58515d5d55db1d0a009a92887f3c.tar.bz2 ingen-ce6dc3d549bc58515d5d55db1d0a009a92887f3c.zip |
Add fancy communication logging
Diffstat (limited to 'src/Log.cpp')
-rw-r--r-- | src/Log.cpp | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/src/Log.cpp b/src/Log.cpp index 46b88aec..4280aaf8 100644 --- a/src/Log.cpp +++ b/src/Log.cpp @@ -20,36 +20,10 @@ #include "ingen/Node.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" - -#ifdef HAVE_ISATTY -# include <unistd.h> -#else -inline int isatty(int fd) { return 0; } -#endif +#include "ingen/ColorContext.hpp" namespace Ingen { -class ColorContext { -public: - enum class Color { RED = 31, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE }; - - ColorContext(FILE* stream, Color color) : stream(stream) { - if (isatty(fileno(stream))) { - fprintf(stream, "\033[0;%dm", color); - } - } - - ~ColorContext() { - if (isatty(fileno(stream))) { - fprintf(stream, "\033[0m"); - fflush(stream); - } - } - - - FILE* stream; -}; - Log::Log(LV2_Log_Log* log, URIs& uris) : _log(log) , _uris(uris) |