Enable bmcweb dynamic logging
Create a CLI app called "bmcweb" that can set logging levels on
"bmcwebd", the new bmcweb daemon. Create a dbus connection to set log
level using the CLI app Define the "setLogLevel" method on dbus to
control logging level in bmcwebd Add logic to move logging level from
build option to dynamic overloading
Reason: bmcweb picks up logging level as a compile flag. We want it to
be more flexible to debug errors in the field. Using the bmcweb CLI
app, we can set log levels on the bmcweb daemon during runtime.
Splitting bmcweb.
For example, to set logging level to INFO on the target:
bmcweb -l INFO
Change-Id: I7192e4d0ac7aa3a91babecc473521be27ea8acd1
Signed-off-by: Aushim Nagarkatti <anagarkatti@nvidia.com>
diff --git a/meson.build b/meson.build
index 065be7f..2eec10b 100644
--- a/meson.build
+++ b/meson.build
@@ -56,6 +56,10 @@
# Include Directories
incdir = include_directories('include', 'redfish-core/include', 'redfish-core/lib', 'http')
+incdir_cli = include_directories(
+ 'http',
+ 'include'
+)
if (get_option('tests').allowed())
summary('unittest', 'NA', section: 'Features')
@@ -184,6 +188,7 @@
# Find the dependency modules, if not found use meson wrap to get them
# automatically during the configure step
bmcweb_dependencies = []
+bmcweb_cli_dependencies = []
pam = cxx.find_library('pam', required: true)
atomic = cxx.find_library('atomic', required: true)
@@ -223,6 +228,16 @@
sdbusplus = sdbusplus.as_system('system')
endif
bmcweb_dependencies += sdbusplus
+bmcweb_cli_dependencies += sdbusplus
+
+cli11 = dependency('CLI11', required : false, include_type: 'system')
+if not cli11.found()
+ cli11_proj = subproject('cli11', required: true)
+ cli11 = cli11_proj.get_variable('CLI11_dep')
+ cli11 = cli11.as_system('system')
+endif
+bmcweb_cli_dependencies += cli11
+
tinyxml = dependency(
'tinyxml2',
@@ -256,7 +271,8 @@
include_type: 'system',
)
if boost.found()
- bmcweb_dependencies += [boost]
+ bmcweb_dependencies += [boost]
+ bmcweb_cli_dependencies += [boost]
else
cmake = import('cmake')
opt = cmake.subproject_options()
@@ -285,6 +301,7 @@
foreach boost_lib : boost_libs
boost_lib_instance = boost.dependency('boost_' + boost_lib).as_system()
bmcweb_dependencies += [boost_lib_instance]
+ bmcweb_cli_dependencies += [boost_lib_instance]
endforeach
endif
@@ -308,7 +325,8 @@
systemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir')
-bindir = get_option('prefix') + '/' + get_option('bindir')
+bindir = get_option('prefix') + '/' +get_option('bindir')
+libexec = get_option('prefix') + '/' + get_option('libexecdir')
summary(
{
@@ -325,6 +343,7 @@
# Config subdirectory
subdir('config')
bmcweb_dependencies += conf_h_dep
+bmcweb_cli_dependencies += conf_h_dep
# Source files
fs = import('fs')
@@ -356,16 +375,26 @@
dependencies: bmcweb_dependencies,
)
-# Generate the bmcweb executable
+# Generate the bmcwebd daemon
executable(
- 'bmcweb',
- 'src/webserver_main.cpp',
- include_directories: incdir,
- dependencies: bmcweb_dependencies,
- link_with: bmcweblib,
- link_args: '-Wl,--gc-sections',
- install: true,
- install_dir: bindir,
+ 'bmcwebd',
+ 'src/webserver_main.cpp',
+ include_directories : incdir,
+ dependencies: bmcweb_dependencies,
+ link_with: bmcweblib,
+ link_args: '-Wl,--gc-sections',
+ install: true,
+ install_dir:libexec
+)
+
+# Generate the bmcweb CLI application
+executable(
+ 'bmcweb',
+ ['src/webserver_cli.cpp','src/boost_asio.cpp'],
+ include_directories : incdir_cli,
+ dependencies: bmcweb_cli_dependencies,
+ install: true,
+ install_dir:bindir
)
srcfiles_unittest = files(