From 275407b3b77591a646be01616062cdb3b0e8fb24 Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Wed, 22 Nov 2023 12:42:51 +0100 Subject: [PATCH] chore(userspace/falco): do not log DEPRECATION NOTICEs before config is inited. Signed-off-by: Federico Di Pierro --- userspace/falco/app/actions/load_config.cpp | 5 +++++ userspace/falco/app/options.cpp | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/userspace/falco/app/actions/load_config.cpp b/userspace/falco/app/actions/load_config.cpp index 7a5b5d4f8be..f76bda8f5ab 100644 --- a/userspace/falco/app/actions/load_config.cpp +++ b/userspace/falco/app/actions/load_config.cpp @@ -46,6 +46,7 @@ static falco::app::run_result apply_deprecated_options(falco::app::state& s) // use the requested driver. if (getenv(FALCO_BPF_ENV_VARIABLE)) { + falco_logger::log(falco_logger::level::WARNING, "DEPRECATION NOTICE: the FALCO_BPF_PROBE environment variable is deprecated and will be removed in Falco 0.38!\n"); s.config->m_engine_mode = engine_kind_t::EBPF; s.config->m_ebpf.m_probe_path = getenv(FALCO_BPF_ENV_VARIABLE); s.config->m_ebpf.m_drop_failed_exit = s.config->m_syscall_drop_failed_exit; @@ -53,6 +54,7 @@ static falco::app::run_result apply_deprecated_options(falco::app::state& s) } else if (s.options.modern_bpf) { + falco_logger::log(falco_logger::level::WARNING, "DEPRECATION NOTICE: the '--modern-bpf' cmdline option is deprecated and will be removed in Falco 0.38!\n"); s.config->m_engine_mode = engine_kind_t::MODERN_EBPF; s.config->m_modern_ebpf.m_drop_failed_exit = s.config->m_syscall_drop_failed_exit; s.config->m_modern_ebpf.m_buf_size_preset = s.config->m_syscall_buf_size_preset; @@ -60,16 +62,19 @@ static falco::app::run_result apply_deprecated_options(falco::app::state& s) } if (!s.options.gvisor_config.empty()) { + falco_logger::log(falco_logger::level::WARNING, "DEPRECATION NOTICE: the '-g,--gvisor-config' cmdline option is deprecated and will be removed in Falco 0.38!\n"); s.config->m_engine_mode = engine_kind_t::GVISOR; s.config->m_gvisor.m_config = s.options.gvisor_config; s.config->m_gvisor.m_root = s.options.gvisor_root; } if (s.options.nodriver) { + falco_logger::log(falco_logger::level::WARNING, "DEPRECATION NOTICE: the '--nodriver' cmdline option is deprecated and will be removed in Falco 0.38!\n"); s.config->m_engine_mode = engine_kind_t::NONE; } if (!s.options.capture_file.empty()) { + falco_logger::log(falco_logger::level::WARNING, "DEPRECATION NOTICE: the '-e' cmdline option is deprecated and will be removed in Falco 0.38!\n"); s.config->m_engine_mode = engine_kind_t::REPLAY; s.config->m_replay.m_capture_file = s.options.capture_file; } diff --git a/userspace/falco/app/options.cpp b/userspace/falco/app/options.cpp index 482f8172827..e65eaf15236 100644 --- a/userspace/falco/app/options.cpp +++ b/userspace/falco/app/options.cpp @@ -147,27 +147,22 @@ bool options::parse(int argc, char **argv, std::string &errstr) if (!capture_file.empty()) { open_modes++; - falco_logger::log(falco_logger::level::WARNING, "DEPRECATION NOTICE: the '-e' cmdline option is deprecated and will be removed in Falco 0.38!\n"); } if (!gvisor_config.empty()) { open_modes++; - falco_logger::log(falco_logger::level::WARNING, "DEPRECATION NOTICE: the '-g,--gvisor-config' cmdline option is deprecated and will be removed in Falco 0.38!\n"); } if(getenv("FALCO_BPF_PROBE") != NULL) { open_modes++; - falco_logger::log(falco_logger::level::WARNING, "DEPRECATION NOTICE: the FALCO_BPF_PROBE environment variable is deprecated and will be removed in Falco 0.38!\n"); } if (modern_bpf) { open_modes++; - falco_logger::log(falco_logger::level::WARNING, "DEPRECATION NOTICE: the '--modern-bpf' cmdline option is deprecated and will be removed in Falco 0.38!\n"); } if (nodriver) { open_modes++; - falco_logger::log(falco_logger::level::WARNING, "DEPRECATION NOTICE: the '--nodriver' cmdline option is deprecated and will be removed in Falco 0.38!\n"); } if (open_modes > 1) {