Data Log

#include <log.h>

The data log is useful for tracking data when your robot is not in range of an IR tower. This was built so as to minimize impact on the rest of the kernel, so it has several bugs that may cause brickOS to crash. If used as prescribed, however, the data log can be a very useful tool.

To use the data log, your program must first allocate space by issuing the command init_log. This command must be issued by your main program thread. If not, brickOS will probably crash.

After your program is finished, the very first thing you should do is retrieve the datalog using the PC-side tools. If you execute a program which does not use the datalog, do not try to download the log, as this may cause brickOS to crash.


int init_log ( size_t size );
Initializes the log, allocating size bytes for it. If a log had already been allocated, the old log is destroyed before the new one is allocated. Returns 1 on success, 0 on failure.

int lprintf ( const char *fmt );
Writes a printf-style-formatted string to the log. Returns the number bytes written to the log.

void destroy_log ( );
Frees the space allocated for the log

int log_size ( );
Returns the log size in bytes

int dump_log ( unsigned char addr );
Dumps the log to the specified LNP address