Log
This page has been automatically translated using the Google Translate API services. We are working on improving texts. Thank you for your understanding and patience.
Registry where a running program can dump information about its internal running.
Functions
uint32_t | log_printf (...) |
void | log_output (...) |
void | log_file (...) |
const char_t* | log_get_file (void) |
A log or diary is a record of anomalies that occur at runtime and that help to further debug the program or determine the cause of an error (Figure 1). This report is aimed more at programmers or software administrators and not at the end user, so it is advisable to include specific technical information on the cause of the problem. The messages addressed to the end user must be written in a more friendly tone, far from technicalities and sent to the standard output (stdout
stderr
) or to the window system, if we are facing a desktop application.
- Use log_printf to write a message to the execution log.
log_printf ()
Write a message in the log, with the printf
format.
uint32_t log_printf(const char_t *format, ...);
1 2 |
log_printf("Leaks of object '%s' (%d bytes)", object->name, object->size); [12:34:23] Leaks of object 'String' (96 bytes) |
format | String with the printf-like format with a variable number of parameters. |
... | Arguments or variables of printf. |
Return
The number of bytes written.
log_output ()
It establishes whether the content of the log will be redirected or not to the standard output.
void log_output(const bool_t std, const bool_t err);
std | If |
err | If |
log_file ()
Set a destination file, where the log lines will be written.
void log_file(const char_t *pathname);
pathname | File name including its absolute or relative path. If the file does not exist it will be created and if it already exists, future lines will be added at the end of it. If |
log_get_file ()
Gets the current file associated with the log.
const char_t* log_get_file(void);
Return
The absolute pathname of the file.