return 0;
}
-static int log_callback(struct pakfire_build* build, void* data,
- int priority, int error, const char* file, int line, const char* function, const char* format, ...) {
+static void log_callback(void* data, int priority, const char* file, int line,
+ const char* function, const char* format, va_list args) {
char* buffer = NULL;
- va_list args;
int r;
// Format the message
- va_start(args, format);
r = vasprintf(&buffer, format, args);
- va_end(args);
-
- // Fail if we could not format the message
if (r < 0)
- return r;
+ return;
switch (priority) {
// Highlight any error messages
// Cleanup
if (buffer)
free(buffer);
-
- return 0;
}
int cli_build(void* data, int argc, char* argv[]) {
if (r)
goto ERROR;
+ // Replace the logger
+ pakfire_ctx_set_log_callback(cli_config->ctx, log_callback, NULL);
+
// Setup pakfire
r = cli_setup_pakfire(&pakfire, cli_config);
if (r)
goto ERROR;
}
- // Set log callback
- pakfire_build_set_log_callback(build, log_callback, NULL);
-
// Set target
if (config.target) {
r = pakfire_build_set_target(build, config.target);