Skip to content

Commit

Permalink
Revert "libosdp: Demote osdp_logger_init to a macro alias"
Browse files Browse the repository at this point in the history
This reverts commit c932fbe.

In preparation for a minor release, let's revert this commit as it
breaks the ABI. This will revert will be undone soon after the release.

Signed-off-by: Siddharth Chandrasekaran <[email protected]>
  • Loading branch information
sidcha committed Oct 28, 2023
1 parent c932fbe commit 6694d6a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
17 changes: 12 additions & 5 deletions include/osdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -994,12 +994,19 @@ void osdp_logger_init3(const char *name, int log_level,
osdp_log_puts_fn_t puts_fn);

/**
* @brief This macro alias Provided for API compatiblity for existing users who
* using the old osdp_logger_init() API. For description of parameters and use,
* see osdp_logger_init3 documentation.
* @brief Configure OSDP Logging (deprecated). Provided for backward
* compatiblity. Use osdp_logger_init3 instead.
*
* @param log_level OSDP log levels of type `enum osdp_log_level_e`. Default is
* LOG_INFO.
* @param puts_fn A puts() like function that will be invoked to write the log
* buffer. Can be handy if you want to log to file on a UART
* device without putchar redirection. See `osdp_log_puts_fn_t`
* definition to see the behavioral expectations. When this is
* set to NULL, LibOSDP will log to stderr.
*/
#define osdp_logger_init(log_level, log_fn) \
osdp_logger_init3("osdp", log_level, log_fn)
void osdp_logger_init(int log_level, osdp_log_puts_fn_t puts_fn)
__attribute__((deprecated("Use osdp_logger_init3 instead!")));

/**
* @brief A callback function that gets called when LibOSDP wants to emit a log
Expand Down
6 changes: 6 additions & 0 deletions src/osdp_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ void osdp_logger_init3(const char *name, int log_level,
logger_set_default(&ctx); /* Mark this config as logging default */
}

OSDP_EXPORT
void osdp_logger_init(int log_level, osdp_log_puts_fn_t log_fn)
{
osdp_logger_init3("osdp", log_level, log_fn);
}

OSDP_EXPORT
void osdp_set_log_callback(osdp_log_callback_fn_t cb)
{
Expand Down

0 comments on commit 6694d6a

Please sign in to comment.