diff options
author | David Robillard <d@drobilla.net> | 2015-08-29 03:26:26 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-08-29 03:26:26 +0000 |
commit | ab26d49a68ce04fce8ba11c301b67a801a6e7acf (patch) | |
tree | 123ade752394276e522d11aaebd6970febb33042 /src/Log.cpp | |
parent | 9e346cb4e4fc4bd4fc25115be9fad111ec326ae8 (diff) | |
download | ingen-ab26d49a68ce04fce8ba11c301b67a801a6e7acf.tar.gz ingen-ab26d49a68ce04fce8ba11c301b67a801a6e7acf.tar.bz2 ingen-ab26d49a68ce04fce8ba11c301b67a801a6e7acf.zip |
Add option to flush logs after every entry.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5711 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/Log.cpp')
-rw-r--r-- | src/Log.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Log.cpp b/src/Log.cpp index 5ce85db3..ccfc2e7c 100644 --- a/src/Log.cpp +++ b/src/Log.cpp @@ -33,6 +33,7 @@ static const char* const ANSI_YELLOW = "\033[0;33m"; Log::Log(LV2_Log_Log* log, URIs& uris) : _log(log) , _uris(uris) + , _flush(false) {} void @@ -42,6 +43,10 @@ Log::error(const std::string& msg) _log->printf(_log->handle, _uris.log_Error, "%s", msg.c_str()); } else { std::cerr << ANSI_RED << msg << ANSI_RESET; + if (_flush) { + std::cerr << "flush!\n"; + std::flush(std::cerr); + } } } @@ -52,6 +57,10 @@ Log::warn(const std::string& msg) _log->printf(_log->handle, _uris.log_Warning, "%s", msg.c_str()); } else { std::cerr << ANSI_YELLOW << msg << ANSI_RESET; + if (_flush) { + std::cerr << "flush!\n"; + std::flush(std::cerr); + } } } @@ -62,6 +71,10 @@ Log::info(const std::string& msg) _log->printf(_log->handle, _uris.log_Note, "%s", msg.c_str()); } else { std::cout << msg; + if (_flush) { + std::cerr << "flush!\n"; + std::flush(std::cout); + } } } |