service_my_plugin_log.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License, version 2.0,
  4. as published by the Free Software Foundation.
  5. This program is also distributed with certain software (including
  6. but not limited to OpenSSL) that is licensed under separate terms,
  7. as designated in a particular file or component or in included license
  8. documentation. The authors of MySQL hereby grant you an additional
  9. permission to link the program and your derivative works with the
  10. separately licensed software that they have included with MySQL.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License, version 2.0, for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
  18. /**
  19. @file
  20. This service provides functions to report error conditions and log to
  21. mysql error log.
  22. */
  23. #ifndef MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED
  24. #define MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED
  25. #ifndef MYSQL_ABI_CHECK
  26. #include <stdarg.h>
  27. #endif
  28. /* keep in sync with the loglevel enum in my_sys.h */
  29. enum plugin_log_level
  30. {
  31. MY_ERROR_LEVEL,
  32. MY_WARNING_LEVEL,
  33. MY_INFORMATION_LEVEL
  34. };
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. extern struct my_plugin_log_service
  39. {
  40. /** write a message to the log */
  41. int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level, const char *, ...);
  42. } *my_plugin_log_service;
  43. #ifdef MYSQL_DYNAMIC_PLUGIN
  44. #define my_plugin_log_message my_plugin_log_service->my_plugin_log_message
  45. #else
  46. int my_plugin_log_message(MYSQL_PLUGIN *plugin, enum plugin_log_level level,
  47. const char *format, ...);
  48. #endif
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #endif