qh_log_set_cl_mode()

Updated: April 19, 2023

Set the logging configuration to command line mode

Synopsis:

#include <qh/log.h>
void qh_log_set_cl_mode(void)

Library:

qh

Description:

Unless configured otherwise, the diagnostics logged through QNX helpers go to slog2. For command line tools, it is more practical to output diagnostics to stderr instead. To make it easier to configure a system to require only the default settings in most situations, call qh_log_set_cl_mode(), which sets the QNX helpers logging configuration to use command line defaults instead of its normal defaults. When this function is called, it rolls back any previous configuration, applies QNX helpers command line defaults, and then applies command line defaults from the following environment variables in this order:

  • QH_LOG_CONFIG_CTX_CL
  • QH_LOG_CONFIG_CTX_CL__progname (__progname)

The QH_LOG_CONFIG_CTX_CL* environment variables have exactly the same format as their QH_LOG_CONFIG_CTX* counterparts, and like those environment variables, the configuration can be locked if the environment variables are set. For more information on the format and the locking mechanism, see Controlling QNX helpers logging.