src/utils/log.c
void buffer_log(const char *format, va_list args){
	// The buffer is full. Empty it by dumping to file
	if(buffer_position >=  LOG_BUFFER_SIZE){
		dump_to_file();
	}

	//Log to the buffer. Keep track of the position with buffer_position
	chars_written = vsprintf(&file_log_buffer[buffer_position], format, args);

	/** This means success. sprintf returns characters written on success
	 *  and there's still more room in the buffer
	*/
	if(chars_written >= 0) {
		buffer_position += chars_written;
	}else{// Has failed, probably not enough space so dump it to file
		dump_to_file();
	}
}
/**
 * Logs to a buffer until it fills, then it dumps the buffer into a file and releases the buffer
 */
Logs to a buffer until it fills, then it dumps the buffer into a file and releases the buffer
Logs to a buffer until it fills then it dumps the buffer into a file and releases the buffer
void buffer_log(const char *format, va_list args){
	if(buffer_position >=  LOG_BUFFER_SIZE){
		dump_to_file();
	}
	chars_written = vsprintf(&file_log_buffer[buffer_position], format, args);
	if(chars_written >= 0) {
		buffer_position += chars_written;
	}else{
		dump_to_file();
	}
}
void buffer_log ( const char * format , va_list args ) { if ( buffer_position >= LOG_BUFFER_SIZE ) { dump_to_file ( ) ; } chars_written = vsprintf ( & file_log_buffer [ buffer_position ] , format , args ) ; if ( chars_written >= 0 ) { buffer_position += chars_written ; } else { dump_to_file ( ) ; } }
Logs to a buffer until it fills, then it dumps the buffer into a file and releases the buffer
Logs to a buffer until it fills then it dumps the buffer into a file and releases the buffer
// The buffer is full. Empty it by dumping to file //Log to the buffer. Keep track of the position with buffer_position /** This means success. sprintf returns characters written on success
	 *  and there's still more room in the buffer
	*/ // Has failed, probably not enough space so dump it to file