qh_log_context_create()

Updated: April 19, 2023

Create a logging context

Synopsis:

#include <qh/log.h>
int qh_log_context_create(const char *name,
                          qh_log_context_t **context)

Arguments:

name
The name of the context to create.
context
The location where the context can be stored.

Library:

qh

Description:

The qh_log_context_create() function creates a logging context with a given name for use with the QNX helpers logging interface. The context name is used as a prefix when the context is used for logging and to match the context when it is specified by name in the API.

Normally, applications and libraries do not call this function directly. Instead, they use the QH_LOG_DEFAULT_CONTEXT_INIT() macro and define QH_LOG_USER_CONTEXT_NAME to hold the context name. For more information, see Setting up QNX helpers logging.

Although it is suboptimal, calling this function more than once with the same context pointer is allowed, but if a context at that address exists already, the name in the second call is ignored.

Returns:

EOK on success or a standard errno on failure.