Log uts information on launch of the session and relay daemon
[lttng-tools.git] / src / common / logging-utils.cpp
diff --git a/src/common/logging-utils.cpp b/src/common/logging-utils.cpp
new file mode 100644 (file)
index 0000000..a0f307a
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2023 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
+ */
+
+#include <common/logging-utils.hpp>
+
+#include <sys/utsname.h>
+
+/* Output system information as logging statements. */
+void lttng::logging::log_system_information(lttng_error_level error_level)
+{
+       struct utsname name = {};
+       const int ret = uname(&name);
+
+       if (ret) {
+               PERROR("Failed to get system information using uname()")
+               return;
+       }
+
+       LOG(error_level, "System information:");
+       LOG(error_level, "\tsysname: `%s`", name.sysname);
+       LOG(error_level, "\tnodename: `%s`", name.nodename);
+       LOG(error_level, "\trelease: `%s`", name.release);
+       LOG(error_level, "\tversion: `%s`", name.version);
+       LOG(error_level, "\tmachine: `%s`", name.machine);
+}
This page took 0.02484 seconds and 4 git commands to generate.