Skip to content
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

Log System #39

Open
jia-xie opened this issue Feb 19, 2024 · 0 comments
Open

Log System #39

jia-xie opened this issue Feb 19, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jia-xie
Copy link
Member

jia-xie commented Feb 19, 2024

Add customized log logic. Possible interface could be:

Log_Info("msg");
Log_Error("msg");
Log_Warning("msg");

The log system gives detialed runtime information and therefore with help with debug. Some examples:

Consider a logic that waits for CAN bus mailbox availability, if the wait time exceeds threshold, it means something goes wrong. The only noticeable behavior in such case might just be a non-working motor. However given only the external behavior would be hard to precisely and efficiently locate the issue.

This is how it used to be like

while (HAL_CAN_GetTxMailboxesFreeLevel(&hcan2) == 0);

possible implementation of logging system

while (HAL_CAN_GetTxMailboxesFreeLevel(&hcan2) == 0) {
    Log_Warning("[can bsp] can mailbox full. CAN send data pending.");
    if (pending_time > PENDING_ERROR_THRESHOLD_TIME) {
        Log_Error("[can bsp] can mailbox is really unhappy for %f s.", pending_time);
    }
}

another example would be receiving CAN frame with unregistered CAN id

@jia-xie jia-xie added the enhancement New feature or request label Feb 20, 2024
@limichael246 limichael246 self-assigned this Feb 24, 2024
@jia-xie jia-xie transferred this issue from another repository Apr 6, 2024
@jia-xie jia-xie mentioned this issue Apr 6, 2024
@jia-xie jia-xie added the good first issue Good for newcomers label Apr 6, 2024
@jia-xie jia-xie changed the title log system Log System Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants