summaryrefslogtreecommitdiff
path: root/src/apk_print.h
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2021-02-14 10:01:02 -0500
committerTimo Teräs <timo.teras@iki.fi>2021-03-19 12:26:15 +0000
commit646c834492a419a96b4032c230e842d27f87e997 (patch)
treef3b78584924624dc73c8ec909f7dc8d685a84db0 /src/apk_print.h
parent4fe5ac83287678a5f870def74ed28f45ab22815f (diff)
downloadapk-tools-646c834492a419a96b4032c230e842d27f87e997.tar.gz
apk-tools-646c834492a419a96b4032c230e842d27f87e997.tar.bz2
apk-tools-646c834492a419a96b4032c230e842d27f87e997.tar.xz
apk-tools-646c834492a419a96b4032c230e842d27f87e997.zip
Log to /var/log/apk.log
This adds a log file at /var/log/apk.log. On each run, apk's version information and the current date & time are written to this file, followed by any normal apk output.
Diffstat (limited to 'src/apk_print.h')
-rw-r--r--src/apk_print.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/apk_print.h b/src/apk_print.h
index ec766ed..132fd8c 100644
--- a/src/apk_print.h
+++ b/src/apk_print.h
@@ -30,11 +30,15 @@ void apk_url_parse(struct apk_url_print *, const char *);
struct apk_out {
int verbosity;
unsigned int width, last_change;
- FILE *out, *err;
+ FILE *out, *err, *log;
};
static inline int apk_out_verbosity(struct apk_out *out) { return out->verbosity; }
+// Pass this as the prefix to skip logging to the console (but still write to
+// the log file).
+#define APK_OUT_LOG_ONLY ((const char*)-1)
+
#define apk_err(out, args...) do { apk_out_fmt(out, "ERROR: ", args); } while (0)
#define apk_out(out, args...) do { apk_out_fmt(out, NULL, args); } while (0)
#define apk_warn(out, args...) do { if (apk_out_verbosity(out) >= 0) { apk_out_fmt(out, "WARNING: ", args); } } while (0)
@@ -44,6 +48,7 @@ static inline int apk_out_verbosity(struct apk_out *out) { return out->verbosity
void apk_out_reset(struct apk_out *);
void apk_out_fmt(struct apk_out *, const char *prefix, const char *format, ...);
+void apk_out_log_argv(struct apk_out *, char **argv);
struct apk_progress {
struct apk_out *out;