summaryrefslogtreecommitdiffstats
path: root/ingen
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-08-01 01:16:15 -0400
committerDavid Robillard <d@drobilla.net>2016-08-01 03:43:56 -0400
commitff6d8a87f9569a42c7827428f2329280c9b633b9 (patch)
treed7ccbeaac5381e8cfd07c4ad5efd0872de65fd45 /ingen
parent7eb24a2761deb9604f1c6b813e6de69876088f9e (diff)
downloadingen-ff6d8a87f9569a42c7827428f2329280c9b633b9.tar.gz
ingen-ff6d8a87f9569a42c7827428f2329280c9b633b9.tar.bz2
ingen-ff6d8a87f9569a42c7827428f2329280c9b633b9.zip
Implement LV2 log extension as host
Only print color logs if output is a terminal.
Diffstat (limited to 'ingen')
-rw-r--r--ingen/Log.hpp22
-rw-r--r--ingen/URIs.hpp1
2 files changed, 22 insertions, 1 deletions
diff --git a/ingen/Log.hpp b/ingen/Log.hpp
index 6c88e9a4..a868e714 100644
--- a/ingen/Log.hpp
+++ b/ingen/Log.hpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2015 David Robillard <http://drobilla.net/>
+ Copyright 2007-2016 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -21,6 +21,7 @@
#include <boost/format.hpp>
+#include "ingen/LV2Features.hpp"
#include "ingen/ingen.h"
#include "lv2/lv2plug.in/ns/ext/log/log.h"
@@ -34,20 +35,39 @@ class INGEN_API Log {
public:
Log(LV2_Log_Log* log, URIs& uris);
+ struct Feature : public LV2Features::Feature {
+ const char* uri() const { return LV2_LOG__log; }
+
+ SPtr<LV2_Feature> feature(World* world, Node* block);
+
+ struct Handle {
+ LV2_Log_Log lv2_log;
+ Log* log;
+ Node* node;
+ };
+ };
+
void error(const std::string& msg);
void info(const std::string& msg);
void warn(const std::string& msg);
+ void trace(const std::string& msg);
inline void error(const fmt& fmt) { error(fmt.str()); }
inline void info(const fmt& fmt) { info(fmt.str()); }
inline void warn(const fmt& fmt) { warn(fmt.str()); }
+ int vtprintf(LV2_URID type, const char* fmt, va_list args);
+
void set_flush(bool f) { _flush = f; }
+ void set_trace(bool f) { _trace = f; }
private:
+ void print(FILE* stream, const std::string& msg);
+
LV2_Log_Log* _log;
URIs& _uris;
bool _flush;
+ bool _trace;
};
} // namespace Ingen
diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp
index 52921085..9fc771da 100644
--- a/ingen/URIs.hpp
+++ b/ingen/URIs.hpp
@@ -127,6 +127,7 @@ public:
const Quark ingen_value;
const Quark log_Error;
const Quark log_Note;
+ const Quark log_Trace;
const Quark log_Warning;
const Quark lv2_AudioPort;
const Quark lv2_CVPort;