aboutsummaryrefslogtreecommitdiffstats
path: root/lv2/lv2plug.in/ns/ext/log/logger.h
diff options
context:
space:
mode:
Diffstat (limited to 'lv2/lv2plug.in/ns/ext/log/logger.h')
-rw-r--r--lv2/lv2plug.in/ns/ext/log/logger.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/lv2/lv2plug.in/ns/ext/log/logger.h b/lv2/lv2plug.in/ns/ext/log/logger.h
index 62de1ce..0ef28b8 100644
--- a/lv2/lv2plug.in/ns/ext/log/logger.h
+++ b/lv2/lv2plug.in/ns/ext/log/logger.h
@@ -50,6 +50,25 @@ typedef struct {
} LV2_Log_Logger;
/**
+ Set `map` as the URI map for `logger`.
+
+ This affects the message type URIDs (Error, Warning, etc) which are passed
+ to the log's print functions.
+*/
+static inline void
+lv2_log_logger_set_map(LV2_Log_Logger* logger, LV2_URID_Map* map)
+{
+ if (map) {
+ logger->Error = map->map(map->handle, LV2_LOG__Error);
+ logger->Note = map->map(map->handle, LV2_LOG__Note);
+ logger->Trace = map->map(map->handle, LV2_LOG__Trace);
+ logger->Warning = map->map(map->handle, LV2_LOG__Warning);
+ } else {
+ logger->Error = logger->Note = logger->Trace = logger->Warning = 0;
+ }
+}
+
+/**
Initialise `logger`.
URIs will be mapped using `map` and stored, a reference to `map` itself is
@@ -61,14 +80,8 @@ lv2_log_logger_init(LV2_Log_Logger* logger,
LV2_URID_Map* map,
LV2_Log_Log* log)
{
- memset(logger, 0, sizeof(LV2_Log_Logger));
logger->log = log;
- if (map) {
- logger->Error = map->map(map->handle, LV2_LOG__Error);
- logger->Note = map->map(map->handle, LV2_LOG__Note);
- logger->Trace = map->map(map->handle, LV2_LOG__Trace);
- logger->Warning = map->map(map->handle, LV2_LOG__Warning);
- }
+ lv2_log_logger_set_map(logger, map);
}
/**