Skip to content

Commit

Permalink
libosdp: Demote osdp_logger_init to a macro alias
Browse files Browse the repository at this point in the history
Since the change is a simple arg addition, we don't really need a proper
deprecation workflow. We could just get away by providing a macro alias
for the old function signature.

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

/**
* @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.
* @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.
*/
void osdp_logger_init(int log_level, osdp_log_puts_fn_t puts_fn)
__attribute__((deprecated("Use osdp_logger_init3 instead!")));
#define osdp_logger_init(log_level, log_fn) \
osdp_logger_init3("osdp", log_level, log_fn)

/**
* @brief A callback function that gets called when LibOSDP wants to emit a log
Expand Down
6 changes: 0 additions & 6 deletions src/osdp_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,6 @@ 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 c932fbe

Please sign in to comment.