Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

log.h 3.3KB

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