diff --git a/src/csync.c b/src/csync.c index 94fa5a5a2a..8cc7e3c552 100644 --- a/src/csync.c +++ b/src/csync.c @@ -771,6 +771,24 @@ int csync_set_auth_callback(CSYNC *ctx, csync_auth_callback cb) { return 0; } +int csync_set_log_verbosity(CSYNC *ctx, int verbosity) { + if (ctx == NULL || verbosity < 0) { + return -1; + } + + ctx->options.log_verbosity = verbosity; + + return 0; +} + +int csync_get_log_verbosity(CSYNC *ctx) { + if (ctx == NULL) { + return -1; + } + + return ctx->options.log_verbosity; +} + int csync_set_log_callback(CSYNC *ctx, csync_log_callback cb) { if (ctx == NULL || cb == NULL) { return -1; diff --git a/src/csync.h b/src/csync.h index 811a7cfa1d..b1675cc327 100644 --- a/src/csync.h +++ b/src/csync.h @@ -325,6 +325,26 @@ csync_auth_callback csync_get_auth_callback(CSYNC *ctx); */ int csync_set_auth_callback(CSYNC *ctx, csync_auth_callback cb); +/** + * @brief Set the log verbosity. + * + * @param ctx The csync context. + * + * @param[in] verbosity The log verbosity. + * + * @return 0 on success, < 0 if an error occured. + */ +int csync_set_log_verbosity(CSYNC *ctx, int verbosity); + +/** + * @brief Get the log verbosity + * + * @param[in] ctx The csync context to ask for the log verbosity. + * + * @return The log verbosity, -1 on error. + */ +int csync_get_log_verbosity(CSYNC *ctx); + /** * @brief Get the logging callback set. * diff --git a/src/csync_private.h b/src/csync_private.h index af720e1ee8..29f6584b35 100644 --- a/src/csync_private.h +++ b/src/csync_private.h @@ -121,6 +121,7 @@ struct csync_s { char *config_dir; bool with_conflict_copys; bool local_only_mode; + int log_verbosity; } options; struct {