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 2.9KB

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