LOG_SYS_FATAL

Table of Contents

LOG_SYS_FATAL

Description

Writes a fatal log message and aborts the program, with errno explanation appended at the end of final string.

Info

Think of this as perror() with LOG

Success

Message logged and program aborted via abort()

Failure

Logging may fail silently, but abort() will still execute

Usage example (Cross-references)

    char *new_str = (char *)malloc(len + 1);
    if (!new_str) {
    LOG_SYS_FATAL("malloc() failed");
    }
    
    if (!buffer) {
    LOG_SYS_FATAL("malloc() failed");
    }
    char *ptr = realloc(vec->data, (n + 1) * vec_aligned_size(vec, item_size));
    if (!ptr) {
    LOG_SYS_FATAL("realloc() failed");
    }
    // it's mandatory to set the pointer here, because next call to any vec_ will do a validation check
    ptr = realloc(vec->data, (vec->length + 1) * vec_aligned_size(vec, item_size));
    if (!ptr) {
    LOG_SYS_FATAL("realloc() failed");
    }
    vec->capacity = vec->length;
    int status;
    if (-1 == waitpid(proc->pid, &status, 0)) {
    LOG_SYS_FATAL("Failed to wait for child process");
    }
    #else
    if (WAIT_FAILED == WaitForSingleObject(proc->pi.hProcess, INFINITE)) {
    LOG_SYS_FATAL("Failed to wait for child process");
    }

Share :

Related Posts

LOG_FATAL

LOG_FATAL Description Writes a fatal log message and aborts the program. …[in] : Format string and arguments following printf-style syntax.

Read More

LOG_ERROR

LOG_ERROR Description Writes an error-level log message. …[in] : Format string and arguments following printf-style syntax.

Read More

FWriteFmtLn

FWriteFmtLn Description Write formatted output to a file stream followed by a newline character. This macro internally uses StrWriteFmtInternal to format the string and then writes it to the stream followed by a newline.

Read More