Fix last commit
[carla.git] / source / includes / lv2 / log.h
blob047316dc8005a93211c5cadf2204e59525e3a8ce
1 /*
2 Copyright 2012-2016 David Robillard <http://drobilla.net>
4 Permission to use, copy, modify, and/or distribute this software for any
5 purpose with or without fee is hereby granted, provided that the above
6 copyright notice and this permission notice appear in all copies.
8 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 /**
18 @defgroup log Log
20 Interface for plugins to log via the host; see
21 <http://lv2plug.in/ns/ext/log> for details.
26 #ifndef LV2_LOG_H
27 #define LV2_LOG_H
29 #define LV2_LOG_URI "http://lv2plug.in/ns/ext/log" ///< http://lv2plug.in/ns/ext/log
30 #define LV2_LOG_PREFIX LV2_LOG_URI "#" ///< http://lv2plug.in/ns/ext/log#
32 #define LV2_LOG__Entry LV2_LOG_PREFIX "Entry" ///< http://lv2plug.in/ns/ext/log#Entry
33 #define LV2_LOG__Error LV2_LOG_PREFIX "Error" ///< http://lv2plug.in/ns/ext/log#Error
34 #define LV2_LOG__Note LV2_LOG_PREFIX "Note" ///< http://lv2plug.in/ns/ext/log#Note
35 #define LV2_LOG__Trace LV2_LOG_PREFIX "Trace" ///< http://lv2plug.in/ns/ext/log#Trace
36 #define LV2_LOG__Warning LV2_LOG_PREFIX "Warning" ///< http://lv2plug.in/ns/ext/log#Warning
37 #define LV2_LOG__log LV2_LOG_PREFIX "log" ///< http://lv2plug.in/ns/ext/log#log
39 #include <stdarg.h>
41 #include "urid.h"
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
47 /** @cond */
48 #ifdef __GNUC__
49 /** Allow type checking of printf-like functions. */
50 # define LV2_LOG_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
51 #else
52 # define LV2_LOG_FUNC(fmt, arg1)
53 #endif
54 /** @endcond */
56 /**
57 Opaque data to host data for LV2_Log_Log.
59 typedef void* LV2_Log_Handle;
61 /**
62 Log feature (LV2_LOG__log)
64 typedef struct _LV2_Log {
65 /**
66 Opaque pointer to host data.
68 This MUST be passed to methods in this struct whenever they are called.
69 Otherwise, it must not be interpreted in any way.
71 LV2_Log_Handle handle;
73 /**
74 Log a message, passing format parameters directly.
76 The API of this function matches that of the standard C printf function,
77 except for the addition of the first two parameters. This function may
78 be called from any non-realtime context, or from any context if `type`
79 is @ref LV2_LOG__Trace.
81 LV2_LOG_FUNC(3, 4)
82 int (*printf)(LV2_Log_Handle handle,
83 LV2_URID type,
84 const char* fmt, ...);
86 /**
87 Log a message, passing format parameters in a va_list.
89 The API of this function matches that of the standard C vprintf
90 function, except for the addition of the first two parameters. This
91 function may be called from any non-realtime context, or from any
92 context if `type` is @ref LV2_LOG__Trace.
94 LV2_LOG_FUNC(3, 0)
95 int (*vprintf)(LV2_Log_Handle handle,
96 LV2_URID type,
97 const char* fmt,
98 va_list ap);
99 } LV2_Log_Log;
101 #ifdef __cplusplus
102 } /* extern "C" */
103 #endif
105 #endif /* LV2_LOG_H */