-
Notifications
You must be signed in to change notification settings - Fork 18
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
Implement Logging Module for GS #277
base: main
Are you sure you want to change the base?
Conversation
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.
I don't see a reason why the logger should be under common. I would move it out to a separate directory instead of it being under common
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.
Overall good, just some minor changes
Also, add |
Tried to log an obc_gs error code using the obc_gs_logger.h and it doesn't work. Instead of sending it to a file as your code indicates it, prints it out. I looked at the reference and it uses |
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.
Your implementation still doesn't work. I'm not getting any errors but when I tried returning if error code for obc_gs_error it would print to the gs_log.log instead of obc_gs_log.log
For each of your logging functions, declare at most 1 returnCode, set the type when declaring it, and then set the errCode before returning. This is to minimize the stack size
Also, add "logger.h" to gs/main.c
Can u try and see if you can return obc_error_code_t and gs_error_code_t directly inside of obc and gs logger respectively. If u can't, lgtm just got to test it. |
@Yarik-Popov do you mean to try to return those error codes without changing the general logger_error_code_t return type? That does't work. |
Yeah. I was suspecting it not to work but still wanted u to try it as this is how I understood what Navtaj said about returning the error codes for each case |
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.
Make ints be of specific size and signedness when applicable. Ill test this pr at the work session today
interfaces/logging/logger.h
Outdated
typedef enum { | ||
OBC_ERROR_CODE, | ||
GS_ERROR_CODE, | ||
} logger_error_type_t; |
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.
not sure why this is needed?
interfaces/logging/logger.h
Outdated
|
||
// Define a general structure to hold the logger error code and its type | ||
typedef struct { | ||
logger_error_type_t type; |
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.
same as above
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.
The logger_error_type_t enum and logger_error_code_t struct were added because we wanted to have a general header file for functions like logErrorCode() that are used by both OBC and GS. We needed a general error code that these functions could return
…ameerahr/system-logging
… nameerahr/system-logging
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.
Changes that should be quick to do. Also, this should be the last set of changes unless if the logging doesn't work properly on obc. gs logging works which is a good sign.
#define LOG_TRACE_FROM_ISR(msg) logMsgFromISR(LOG_TRACE, __FILE__, __LINE__, msg) | ||
#define LOG_DEBUG_FROM_ISR(msg) logMsgFromISR(LOG_DEBUG, __FILE__, __LINE__, msg) | ||
#define LOG_INFO_FROM_ISR(msg) logMsgFromISR(LOG_INFO, __FILE__, __LINE__, msg) | ||
#define LOG_WARN_FROM_ISR(msg) logMsgFromISR(LOG_WARN, __FILE__, __LINE__, msg) | ||
#define LOG_ERROR_FROM_ISR(msg) logMsgFromISR(LOG_ERROR, __FILE__, __LINE__, msg) | ||
#define LOG_FATAL_FROM_ISR(msg) logMsgFromISR(LOG_FATAL, __FILE__, __LINE__, msg) |
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 obc logging header file as gs doesn't have ISR logging
/** | ||
* @brief Log an error code from ISR | ||
* | ||
* @param msgLevel Level of the message | ||
* @param file File of message | ||
* @param line Line of message | ||
* @param errCode The error code that needs to be logged | ||
* @return logger_error_code_t with success code if log is successful. | ||
* | ||
*/ | ||
logger_error_code_t logErrorCodeFromISR(log_level_t msgLevel, const char *file, uint32_t line, uint32_t errCode); | ||
|
||
/** | ||
* @brief Log a message from ISR | ||
* | ||
* @param msgLevel Level of the message | ||
* @param file File of message | ||
* @param line Line of message | ||
* @param msg The message that should be logged (MUST BE STATIC) | ||
* @return logger_error_code_t with success code if log is successful. | ||
* | ||
*/ | ||
logger_error_code_t logMsgFromISR(log_level_t msgLevel, const char *file, uint32_t line, const char *msg); |
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 obc logging header file as gs doesn't have ISR logging
Purpose
Setup up logging so it can be done uniformly throughout the system.
https://www.notion.so/uworbital/Implement-system-wide-logging-2327c75823fb40d7b2121eafc7001993?pvs=4
New Changes
gs
andobc_gs_interface
.Testing
Outstanding Changes