2
0

logging.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*!
  2. \ingroup Logging
  3. \brief This function registers a logging callback that will be used to
  4. handle the wolfSSL log message. By default, if the system supports it
  5. fprintf() to stderr is used but by using this function anything
  6. can be done by the user.
  7. \return Success If successful this function will return 0.
  8. \return BAD_FUNC_ARG is the error that will be returned if a function
  9. pointer is not provided.
  10. \param log_function function to register as a logging callback.
  11. Function signature must follow the above prototype.
  12. _Example_
  13. \code
  14. int ret = 0;
  15. // Logging callback prototype
  16. void MyLoggingCallback(const int logLevel, const char* const logMessage);
  17. // Register the custom logging callback with wolfSSL
  18. ret = wolfSSL_SetLoggingCb(MyLoggingCallback);
  19. if (ret != 0) {
  20. // failed to set logging callback
  21. }
  22. void MyLoggingCallback(const int logLevel, const char* const logMessage)
  23. {
  24. // custom logging function
  25. }
  26. \endcode
  27. \sa wolfSSL_Debugging_ON
  28. \sa wolfSSL_Debugging_OFF
  29. */
  30. int wolfSSL_SetLoggingCb(wolfSSL_Logging_cb log_function);
  31. /*!
  32. \ingroup Debug
  33. \brief If logging has been enabled at build time this function turns on
  34. logging at runtime. To enable logging at build time use --enable-debug
  35. or define DEBUG_WOLFSSL.
  36. \return 0 upon success.
  37. \return NOT_COMPILED_IN is the error that will be returned if logging
  38. isn’t enabled for this build.
  39. \param none No parameters.
  40. _Example_
  41. \code
  42. wolfSSL_Debugging_ON();
  43. \endcode
  44. \sa wolfSSL_Debugging_OFF
  45. \sa wolfSSL_SetLoggingCb
  46. */
  47. int wolfSSL_Debugging_ON(void);
  48. /*!
  49. \ingroup Debug
  50. \brief This function turns off runtime logging messages. If they’re
  51. already off, no action is taken.
  52. \return none No returns.
  53. \param none No parameters.
  54. _Example_
  55. \code
  56. wolfSSL_Debugging_OFF();
  57. \endcode
  58. \sa wolfSSL_Debugging_ON
  59. \sa wolfSSL_SetLoggingCb
  60. */
  61. void wolfSSL_Debugging_OFF(void);