Cross-platform C SDK logo

Cross-platform C SDK


❮ Back
Next ❯
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.


uint32_tlog_printf (...)
voidlog_output (...)
voidlog_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.
  • Schema of a process sending information to a log.
    Figure 1: Messages related to internal anomalies of the program, can be sent to a log.
❮ Back
Next ❯

log_printf ()

Write a message in the log, with the printf format.

log_printf(const char_t *format,
log_printf("Leaks of object '%s' (%d bytes)", object->name, object->size);
[12:34:23] Leaks of object 'String' (96 bytes)

String with the printf-like format with a variable number of parameters.


Arguments or variables of printf.


The number of bytes written.

log_output ()

It establishes whether the content of the log will be redirected or not to the standard output.

log_output(const bool_t std,
           const bool_t err);

If TRUE the lines will be sent to the standard output stdout. Default, TRUE.


If TRUE the lines will be sent to the error output stderr. Default, FALSE.

log_file ()

Set a destination file, where the log lines will be written.

log_file(const char_t *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 NULL writing to log file will be disabled.

log_get_file ()

Gets the current file associated with the log.

const char_t*


The absolute pathname of the file.

❮ Back
Next ❯