summaryrefslogtreecommitdiff
path: root/src/shutdown
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@canonical.com>2019-07-15 09:56:24 -0400
committerDan Streetman <ddstreet@canonical.com>2020-02-10 07:01:30 -0500
commitc5673ed0de3bec38f68d8113d253842b47766e27 (patch)
treeab275a4760e03c667da4702f99fc096944b90cf6 /src/shutdown
parent2526af6ddde359cc2ac9e475f3dc6effde2e25af (diff)
downloadsystemd-c5673ed0de3bec38f68d8113d253842b47766e27.tar.gz
log: add support for prefixing console log messages with current timestamp
Diffstat (limited to 'src/shutdown')
-rw-r--r--src/shutdown/shutdown.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c
index 15e6c1799e..c405ab9744 100644
--- a/src/shutdown/shutdown.c
+++ b/src/shutdown/shutdown.c
@@ -51,6 +51,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_LOG_TARGET,
ARG_LOG_COLOR,
ARG_LOG_LOCATION,
+ ARG_LOG_TIME,
ARG_EXIT_CODE,
ARG_TIMEOUT,
};
@@ -60,6 +61,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "log-target", required_argument, NULL, ARG_LOG_TARGET },
{ "log-color", optional_argument, NULL, ARG_LOG_COLOR },
{ "log-location", optional_argument, NULL, ARG_LOG_LOCATION },
+ { "log-time", optional_argument, NULL, ARG_LOG_TIME },
{ "exit-code", required_argument, NULL, ARG_EXIT_CODE },
{ "timeout", required_argument, NULL, ARG_TIMEOUT },
{}
@@ -110,6 +112,17 @@ static int parse_argv(int argc, char *argv[]) {
break;
+ case ARG_LOG_TIME:
+
+ if (optarg) {
+ r = log_show_time_from_string(optarg);
+ if (r < 0)
+ log_error_errno(r, "Failed to parse log time setting %s, ignoring: %m", optarg);
+ } else
+ log_show_time(true);
+
+ break;
+
case ARG_EXIT_CODE:
r = safe_atou8(optarg, &arg_exit_code);
if (r < 0)