mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 02:09:30 +02:00
Fix bugs in printf logging code & add version to log
- Fix printf end of line detection - Fix overwriting of timestamp in printf path - Add version + build date/time to log
This commit is contained in:
parent
cc4229f774
commit
0512d02101
2 changed files with 7 additions and 6 deletions
|
@ -85,14 +85,13 @@ size_t Logging::write(const uint8_t* buffer, size_t size) {
|
|||
|
||||
void Logging::printf(const char* fmt, ...) {
|
||||
#ifdef DEBUG_LOG
|
||||
char* message_string = datalayer.system.info.logged_can_messages;
|
||||
int offset = datalayer.system.info.logged_can_messages_offset; // Keeps track of the current position in the buffer
|
||||
size_t message_string_size = sizeof(datalayer.system.info.logged_can_messages);
|
||||
|
||||
if (previous_message_was_newline) {
|
||||
add_timestamp(MAX_LINE_LENGTH_PRINTF);
|
||||
}
|
||||
|
||||
char* message_string = datalayer.system.info.logged_can_messages;
|
||||
size_t message_string_size = sizeof(datalayer.system.info.logged_can_messages);
|
||||
int offset = datalayer.system.info.logged_can_messages_offset; // Keeps track of the current position in the buffer
|
||||
static char buffer[MAX_LINE_LENGTH_PRINTF];
|
||||
char* message_buffer;
|
||||
#ifdef DEBUG_VIA_WEB
|
||||
|
@ -132,6 +131,6 @@ void Logging::printf(const char* fmt, ...) {
|
|||
}
|
||||
#endif // DEBUG_VIA_WEB
|
||||
|
||||
previous_message_was_newline = buffer[size - 1] == '\n';
|
||||
previous_message_was_newline = message_buffer[size - 1] == '\n';
|
||||
#endif // DEBUG_LOG
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue