diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2016-07-25 12:20:22 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2016-08-09 18:24:45 +0200 |
commit | ef69934746e7c31aef224129b19ac0cfb8101b5b (patch) | |
tree | 61682172c53de0fda0a530a41ed0b6312a678c17 /lib/log | |
parent | 06ce9b4e4238da58d6c2acda7878dbc51245a8fc (diff) | |
download | lvm2-ef69934746e7c31aef224129b19ac0cfb8101b5b.tar.gz |
shell: also collect last command's return code for subsequent 'lastlog' invocation
Add new log_context=shell and with log_object_type=cmd and
log_object_name=<command_name> for command log report to collect
overall return code from last command (this is reported under
log_type=status).
Diffstat (limited to 'lib/log')
-rw-r--r-- | lib/log/log.c | 2 | ||||
-rw-r--r-- | lib/log/lvm-logging.h | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/log/log.c b/lib/log/log.c index d021ffe6e..c933154b5 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -449,6 +449,7 @@ static const char *_get_log_level_name(int use_stderr, int level) const char *log_get_report_context_name(log_report_context_t context) { static const char *log_context_names[LOG_REPORT_CONTEXT_COUNT] = {[LOG_REPORT_CONTEXT_NULL] = "", + [LOG_REPORT_CONTEXT_SHELL] = "shell", [LOG_REPORT_CONTEXT_PROCESSING] = "processing"}; return log_context_names[context]; } @@ -457,6 +458,7 @@ const char *log_get_report_context_name(log_report_context_t context) const char *log_get_report_object_type_name(log_report_object_type_t object_type) { static const char *log_object_type_names[LOG_REPORT_OBJECT_TYPE_COUNT] = {[LOG_REPORT_OBJECT_TYPE_NULL] = "", + [LOG_REPORT_OBJECT_TYPE_CMD] = "cmd", [LOG_REPORT_OBJECT_TYPE_ORPHAN] = "orphan", [LOG_REPORT_OBJECT_TYPE_PV] = "pv", [LOG_REPORT_OBJECT_TYPE_LABEL] = "label", diff --git a/lib/log/lvm-logging.h b/lib/log/lvm-logging.h index 7ddbf2c31..64c1928ff 100644 --- a/lib/log/lvm-logging.h +++ b/lib/log/lvm-logging.h @@ -77,12 +77,14 @@ void syslog_suppress(int suppress); /* Hooks to handle logging through report. */ typedef enum { LOG_REPORT_CONTEXT_NULL, + LOG_REPORT_CONTEXT_SHELL, LOG_REPORT_CONTEXT_PROCESSING, LOG_REPORT_CONTEXT_COUNT } log_report_context_t; typedef enum { LOG_REPORT_OBJECT_TYPE_NULL, + LOG_REPORT_OBJECT_TYPE_CMD, LOG_REPORT_OBJECT_TYPE_ORPHAN, LOG_REPORT_OBJECT_TYPE_PV, LOG_REPORT_OBJECT_TYPE_LABEL, @@ -101,6 +103,10 @@ typedef struct log_report { const char *object_group_id; } log_report_t; +#define LOG_STATUS_NAME "status" +#define LOG_STATUS_SUCCESS "success" +#define LOG_STATUS_FAILURE "failure" + log_report_t log_get_report_state(void); void log_restore_report_state(log_report_t log_report); |