// Create a new Pakfire instance
int r = pakfire_create(&self->pakfire, path, arch, conf, flags,
- Pakfire_log_callback, self->callbacks.log);
+ LOG_DEBUG, Pakfire_log_callback, self->callbacks.log);
if (r) {
switch (errno) {
// Invalid architecture or path
int progress, const char* status);
int pakfire_create(struct pakfire** pakfire, const char* path, const char* arch,
- const char* conf, int flags, pakfire_log_callback log_callback, void* log_data);
+ const char* conf, int flags,
+ int loglevel, pakfire_log_callback log_callback, void* log_data);
struct pakfire* pakfire_ref(struct pakfire* pakfire);
struct pakfire* pakfire_unref(struct pakfire* pakfire);
PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, const char* path,
const char* arch, const char* conf, int flags,
- pakfire_log_callback log_callback, void* log_data) {
+ int loglevel, pakfire_log_callback log_callback, void* log_data) {
char tempdir[PATH_MAX] = PAKFIRE_TMP_DIR "/XXXXXX";
int r = 1;
else
pakfire_set_log_callback(p, pakfire_log_syslog, NULL);
- const char* env = secure_getenv("PAKFIRE_LOG");
- if (env)
- pakfire_log_set_priority(p, log_priority(env));
+ // Set log level
+ if (loglevel) {
+ pakfire_log_set_priority(p, loglevel);
+ } else {
+ const char* env = secure_getenv("PAKFIRE_LOG");
+ if (env)
+ pakfire_log_set_priority(p, log_priority(env));
+ }
// Setup confirm callback
pakfire_set_confirm_callback(p, pakfire_ui_confirm, NULL);
// Create a pakfire instance
r = pakfire_create(&t->pakfire, root, NULL, TEST_SRC_PATH "/pakfire.conf",
- 0, pakfire_log_stderr, NULL);
+ 0, LOG_DEBUG, pakfire_log_stderr, NULL);
if (r) {
LOG("ERROR: Could not initialize pakfire: %m\n");
exit(1);
}
- // Enable debug logging
- pakfire_log_set_priority(t->pakfire, LOG_DEBUG);
-
r = t->func(t);
if (r)
LOG("Test failed with error code: %d\n", r);