Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/alpm.h
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2014-09-28 17:45:35 -0400
committerAllan McRae <allan@archlinux.org>2014-09-30 12:56:21 +1000
commitb52ed49d75ff77ef4f6ad2bef576184bda9b98d0 (patch)
treeb4c7f71acf22f05302ebaf76967f18521a713275 /lib/libalpm/alpm.h
parent31b98626003fec9e33483152552906a601c072d4 (diff)
Revert "Remove log_cb, add ALPM_EVENT_LOG instead"
Moving logging to the event callback caused warnings under clang due to non-literal format strings and silenced all log messages when --print was used. This reverts commit cd793c5ab7689cc8cbc18277375b368060e5acfe. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Conflicts: lib/libalpm/alpm.h src/pacman/callback.c Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/alpm.h')
-rw-r--r--lib/libalpm/alpm.h36
1 files changed, 15 insertions, 21 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 751fa633..1cfd4f5b 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -343,6 +343,16 @@ typedef struct _alpm_siglist_t {
* Logging facilities
*/
+/** Logging Levels */
+typedef enum _alpm_loglevel_t {
+ ALPM_LOG_ERROR = 1,
+ ALPM_LOG_WARNING = (1 << 1),
+ ALPM_LOG_DEBUG = (1 << 2),
+ ALPM_LOG_FUNCTION = (1 << 3)
+} alpm_loglevel_t;
+
+typedef void (*alpm_cb_log)(alpm_loglevel_t, const char *, va_list);
+
int alpm_logaction(alpm_handle_t *handle, const char *prefix,
const char *fmt, ...) __attribute__((format(printf, 3, 4)));
@@ -431,8 +441,6 @@ typedef enum _alpm_event_type_t {
ALPM_EVENT_KEY_DOWNLOAD_START,
/** Key downloading is finished. */
ALPM_EVENT_KEY_DOWNLOAD_DONE,
- /** A log message was emitted; See alpm_event_log_t for arguments. */
- ALPM_EVENT_LOG,
/** A .pacnew file was created; See alpm_event_pacnew_created_t for arguments. */
ALPM_EVENT_PACNEW_CREATED,
/** A .pacsave file was created; See alpm_event_pacsave_created_t for
@@ -502,24 +510,6 @@ typedef struct _alpm_event_database_missing_t {
const char *dbname;
} alpm_event_database_missing_t;
-/** Log levels. */
-typedef enum _alpm_loglevel_t {
- ALPM_LOG_ERROR = 1,
- ALPM_LOG_WARNING = (1 << 1),
- ALPM_LOG_DEBUG = (1 << 2),
- ALPM_LOG_FUNCTION = (1 << 3)
-} alpm_loglevel_t;
-
-typedef struct _alpm_event_log_t {
- /** Type of event. */
- alpm_event_type_t type;
- /** Log level. */
- alpm_loglevel_t level;
- /** Message. */
- const char *fmt;
- va_list args;
-} alpm_event_log_t;
-
typedef struct _alpm_event_pkgdownload_t {
/** Type of event. */
alpm_event_type_t type;
@@ -571,7 +561,6 @@ typedef union _alpm_event_t {
alpm_event_delta_patch_t delta_patch;
alpm_event_scriptlet_info_t scriptlet_info;
alpm_event_database_missing_t database_missing;
- alpm_event_log_t log;
alpm_event_pkgdownload_t pkgdownload;
alpm_event_pacnew_created_t pacnew_created;
alpm_event_pacsave_created_t pacsave_created;
@@ -749,6 +738,11 @@ char *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url);
* @{
*/
+/** Returns the callback used for logging. */
+alpm_cb_log alpm_option_get_logcb(alpm_handle_t *handle);
+/** Sets the callback used for logging. */
+int alpm_option_set_logcb(alpm_handle_t *handle, alpm_cb_log cb);
+
/** Returns the callback used to report download progress. */
alpm_cb_download alpm_option_get_dlcb(alpm_handle_t *handle);
/** Sets the callback used to report download progress. */