src/cLogBuffer.cpp
// get all log messages from the buffer
get all log messages from the buffer
get all log messages from the buffer
uint16_t cLogBuffer::get_all_logs(char *str, const uint16_t max_len){
  uint16_t str_len = 0;
  for(uint8_t i=1;i<LOGBUFFER_MAX_NUM;i++){
    const uint8_t n = (_n_buffer+i) % LOGBUFFER_MAX_NUM;
    const char *buf = &_buffer[n][0];
    const uint16_t len = strlen(buf);
    if( len>0 ){
      if( str_len + len >= max_len ){
        memcpy( str + str_len, buf, max_len - str_len - 1 );
        str[max_len-1] = 0;
        return max_len;
      }
      else{
        strcpy( str + str_len, buf );
        str_len+= len;
      }
    }
  }
  return str_len;
}
uint16_t cLogBuffer :: get_all_logs ( char * str , const uint16_t max_len ) { uint16_t str_len = 0 ; for ( uint8_t i = 1 ; i < LOGBUFFER_MAX_NUM ; i ++ ) { const uint8_t n = ( _n_buffer + i ) % LOGBUFFER_MAX_NUM ; const char * buf = & _buffer [ n ] [ 0 ] ; const uint16_t len = strlen ( buf ) ; if ( len > 0 ) { if ( str_len + len >= max_len ) { memcpy ( str + str_len , buf , max_len - str_len - 1 ) ; str [ max_len - 1 ] = 0 ; return max_len ; } else { strcpy ( str + str_len , buf ) ; str_len += len ; } } } return str_len ; }
get all log messages from the buffer
get all log messages from the buffer