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

JW_STR

JW_STR Description Append a string value (quoted) to the JSON.

Read More

LOG_INFO

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

Read More

JW_FLT

JW_FLT Description Append a floating-point value to a JSON string.

Read More