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.

108 lines
2.9KB

  1. /*
  2. Copyright 2012 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"
  23. #define LV2_LOG_PREFIX LV2_LOG_URI "#"
  24. #define LV2_LOG__Entry LV2_LOG_PREFIX "Entry"
  25. #define LV2_LOG__Error LV2_LOG_PREFIX "Error"
  26. #define LV2_LOG__Note LV2_LOG_PREFIX "Note"
  27. #define LV2_LOG__Trace LV2_LOG_PREFIX "Trace"
  28. #define LV2_LOG__Warning LV2_LOG_PREFIX "Warning"
  29. #define LV2_LOG__log LV2_LOG_PREFIX "log"
  30. #include <stdarg.h>
  31. #include "urid.h"
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #ifdef __GNUC__
  36. /** Allow type checking of printf-like functions. */
  37. # define LV2_LOG_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
  38. #else
  39. # define LV2_LOG_FUNC(fmt, arg1)
  40. #endif
  41. /**
  42. Opaque data to host data for LV2_Log_Log.
  43. */
  44. typedef void* LV2_Log_Handle;
  45. /**
  46. Log feature (LV2_LOG__log)
  47. */
  48. typedef struct _LV2_Log {
  49. /**
  50. Opaque pointer to host data.
  51. This MUST be passed to methods in this struct whenever they are called.
  52. Otherwise, it must not be interpreted in any way.
  53. */
  54. LV2_Log_Handle handle;
  55. /**
  56. Log a message, passing format parameters directly.
  57. The API of this function matches that of the standard C printf function,
  58. except for the addition of the first two parameters. This function may
  59. be called from any non-realtime context, or from any context if `type`
  60. is @ref LV2_LOG__Trace.
  61. */
  62. LV2_LOG_FUNC(3, 4)
  63. int (*printf)(LV2_Log_Handle handle,
  64. LV2_URID type,
  65. const char* fmt, ...);
  66. /**
  67. Log a message, passing format parameters in a va_list.
  68. The API of this function matches that of the standard C vprintf
  69. function, except for the addition of the first two parameters. This
  70. function may be called from any non-realtime context, or from any
  71. context if `type` is @ref LV2_LOG__Trace.
  72. */
  73. LV2_LOG_FUNC(3, 0)
  74. int (*vprintf)(LV2_Log_Handle handle,
  75. LV2_URID type,
  76. const char* fmt,
  77. va_list ap);
  78. } LV2_Log_Log;
  79. #ifdef __cplusplus
  80. } /* extern "C" */
  81. #endif
  82. #endif /* LV2_LOG_H */
  83. /**
  84. @}
  85. */