summaryrefslogtreecommitdiff
path: root/src/basic/log.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-09-21 14:05:35 +0200
committerSven Eden <yamakuzure@gmx.net>2017-09-21 14:05:35 +0200
commit58da9c4933dc569030ba1bc54386cf04838ac0dc (patch)
tree5a4908595622ec30d3387f9da2c59b643459d882 /src/basic/log.h
parentfeab16e5e3c1fa3469405bde91b542e5dcf0aa40 (diff)
core: whenever a unit terminates, log its consumed resources to the journal
This adds a new recognizable log message for each unit invocation that contains structured information about consumed resources of the unit as a whole after it terminated. This is particular useful for apps that want to figure out what the resource consumption of a unit given a specific invocation ID was. The log message is only generated for units that have at least one XyzAccounting= property turned on, and currently only covers IP traffic and CPU time metrics.
Diffstat (limited to 'src/basic/log.h')
-rw-r--r--src/basic/log.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/basic/log.h b/src/basic/log.h
index d3d6e6e73..38b71a593 100644
--- a/src/basic/log.h
+++ b/src/basic/log.h
@@ -188,6 +188,15 @@ int log_format_iovec(
const char *format,
va_list ap) _printf_(6, 0);
+int log_struct_iovec_internal(
+ int level,
+ int error,
+ const char *file,
+ int line,
+ const char *func,
+ const struct iovec input_iovec[],
+ size_t n_input_iovec);
+
/* This modifies the buffer passed! */
int log_dump_internal(
int level,
@@ -276,6 +285,11 @@ void log_assert_failed_return_realm(
error, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define log_struct(level, ...) log_struct_errno(level, 0, __VA_ARGS__)
+#define log_struct_iovec_errno(level, error, iovec, n_iovec) \
+ log_struct_iovec_internal(LOG_REALM_PLUS_LEVEL(LOG_REALM, level), \
+ error, __FILE__, __LINE__, __func__, iovec, n_iovec)
+#define log_struct_iovec(level, iovec, n_iovec) log_struct_iovec_errno(level, 0, iovec, n_iovec)
+
/* This modifies the buffer passed! */
#define log_dump(level, buffer) \
log_dump_internal(LOG_REALM_PLUS_LEVEL(LOG_REALM, level), \