-
Notifications
You must be signed in to change notification settings - Fork 37
control logger thru CTL #1446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
control logger thru CTL #1446
Conversation
0a0d049
to
777a17a
Compare
src/utils/CMakeLists.txt
Outdated
@@ -32,7 +33,7 @@ add_umf_library( | |||
NAME umf_utils | |||
TYPE STATIC | |||
SRCS ${UMF_UTILS_SOURCES} | |||
LIBS ${UMF_UTILS_LIBS} ${CMAKE_THREAD_LIBS_INIT}) | |||
LIBS ${UMF_UTILS_LIBS} ${CMAKE_THREAD_LIBS_INIT} umf_ba) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should avoid this if possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok for now, but please fill an issue to fix this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/utils/utils_log.c
Outdated
@@ -61,14 +62,15 @@ char const __umf_str_1__all_cmake_vars[] = | |||
#define MAX_ENV_LEN 2048 | |||
|
|||
typedef struct { | |||
int timestamp; | |||
int pid; | |||
bool timestamp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add comment "enable timestamp logging" or rename to enableTimestamp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/utils/utils_log.c
Outdated
int timestamp; | ||
int pid; | ||
bool timestamp; | ||
bool pid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/utils/utils_log.c
Outdated
} utils_log_config_t; | ||
|
||
utils_log_config_t loggerConfig = {0, 0, LOG_ERROR, LOG_ERROR, NULL}; | ||
utils_log_config_t loggerConfig = {0, 0, LOG_ERROR, LOG_ERROR, NULL, NULL}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0, 0 -> false, false
src/utils/utils_log.c
Outdated
} | ||
|
||
if (loggerConfig.output == NULL) { | ||
*arg_out = "logger_disabled"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just "disabled"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about "" ? is it different from NULL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will never be set to ""
test/ctl/ctl_api.cpp
Outdated
|
||
TEST_F(test, ctl_logger_output_file) { | ||
const char *file_name = "ctl_log.txt"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/utils/utils_log.cpp
Outdated
#include "test_helpers.h" | ||
#include <umf/experimental/ctl.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to the top (new section)
test/utils/utils_log.cpp
Outdated
@@ -141,7 +143,7 @@ void helper_checkConfig(utils_log_config_t *expected, utils_log_config_t *is) { | |||
|
|||
TEST_F(test, parseEnv_errors) { | |||
expected_message = ""; | |||
loggerConfig = {0, 0, LOG_ERROR, LOG_ERROR, NULL}; | |||
loggerConfig = {0, 0, LOG_ERROR, LOG_ERROR, NULL, ""}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool, bool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -212,7 +214,8 @@ TEST_F(test, parseEnv) { | |||
flushLevel.first + ";" + | |||
output.first + ";" + | |||
timestamp.first + ";" + pid.first; | |||
b = loggerConfig = {0, 0, LOG_ERROR, LOG_ERROR, NULL}; | |||
b = loggerConfig = {0, 0, LOG_ERROR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false, false here and in other places
btw why such weird formatting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done,
clang format? who knows
const char *oldName = | ||
loggerConfig.file_name ? loggerConfig.file_name : "disabled"; | ||
|
||
if (arg_in == NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about ""?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fopen will fail, and we will return an error for invalid argument
Description
Checklist