summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-08-29 03:26:26 +0000
committerDavid Robillard <d@drobilla.net>2015-08-29 03:26:26 +0000
commitab26d49a68ce04fce8ba11c301b67a801a6e7acf (patch)
tree123ade752394276e522d11aaebd6970febb33042 /src
parent9e346cb4e4fc4bd4fc25115be9fad111ec326ae8 (diff)
downloadingen-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')
-rw-r--r--src/Configuration.cpp1
-rw-r--r--src/Log.cpp13
-rw-r--r--src/World.cpp1
3 files changed, 15 insertions, 0 deletions
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index 70b76b20..0f3e3d53 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -64,6 +64,7 @@ Configuration::Configuration(Forge& forge)
add("execute", "execute", 'x', "File of commands to execute", SESSION, forge.String, Atom());
add("path", "path", 'L', "Target path for loaded graph", SESSION, forge.String, Atom());
add("queueSize", "queue-size", 'q', "Event queue size", GLOBAL, forge.Int, forge.make(4096));
+ add("flushLog", "flush-log", 'f', "Flush logs after every entry", SESSION, forge.Bool, forge.make(false));
add("humanNames", "human-names", 0, "Show human names in GUI", GUI, forge.Bool, forge.make(true));
add("portLabels", "port-labels", 0, "Show port labels in GUI", GUI, forge.Bool, forge.make(true));
add("graphDirectory", "graph-directory", 0, "Default directory for opening graphs", GUI, forge.String, Atom());
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);
+ }
}
}
diff --git a/src/World.cpp b/src/World.cpp
index d3859563..9d4410eb 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -120,6 +120,7 @@ public:
// Parse command line options, overriding configuration file values
conf.parse(argc, argv);
+ log.set_flush(conf.option("flush-log").get<int32_t>());
lv2_features = new LV2Features();
lv2_features->add_feature(uri_map->urid_map_feature());