arduino-logger icon indicating copy to clipboard operation
arduino-logger copied to clipboard

Improve Checks for Flushing and Overrun

Open phillipjohnston opened this issue 4 years ago • 0 comments

Right now, we do this check per-character, which is quite inefficient:

	virtual void log_add_char_to_buffer(char c)
	{
		if(auto_flush() && (internal_size() == internal_capacity()))
		{
			flush();
		}
		else if (internal_size() == internal_capacity())
		{
			overrun_occurred_ = true;
		}

		log_putc(c);
	}

Ideally we'd check for the full contents of the string to be added to the log, splitting earlier than the character level. Perhaps this occurs in print()?

phillipjohnston avatar Apr 15 '21 17:04 phillipjohnston