Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbedConnectorInterface by
Diff: api/Logger.cpp
- Revision:
- 5:a929d65eb385
- Parent:
- 2:853f9ecc12df
- Child:
- 16:383ad1356963
--- a/api/Logger.cpp Wed Jan 28 12:11:22 2015 +0000 +++ b/api/Logger.cpp Wed Jan 28 14:43:46 2015 +0000 @@ -39,19 +39,22 @@ { } -// Log output -void Logger::log(const char *format,...) -{ +// Log the ouput to the attached serial console +void Logger::logIt(const char *format,...) +{ + // build the variable args into a string va_list args; - va_start(args,format); - if (this->m_pc != NULL) { - //this->m_pc->printf(format,args); - //this->m_pc->printf("\r\n"); - std::printf(format,args); - std::printf("\r\n"); - } else { - std::printf(format,args); - std::printf("\r\n"); - } + char buffer[LOGGER_BUFFER_LENGTH+1]; + memset(buffer,0,LOGGER_BUFFER_LENGTH+1); + va_start(args, format); + vsnprintf(buffer,LOGGER_BUFFER_LENGTH,format,args); + + // clean up... va_end(args); + + // print it... + if (this->m_pc != NULL) + this->m_pc->printf("%s",buffer); + else + std::printf("%s",buffer); }