dmi_set_log_level

Synopsis

#include <opendmi/context.h>

bool dmi_set_log_level(dmi_context_t *context, dmi_log_level_t level);

Description

The dmi_set_log_level function sets the least severe level of the messages the context writes to its handler. Messages of the levels less severe than level are dropped before they reach the handler, which may drop more of them by a level of its own.

Levels are ordered from the most severe one to the least: DMI_LOG_ERROR, DMI_LOG_WARNING, DMI_LOG_NOTICE, DMI_LOG_INFO and DMI_LOG_DEBUG.

The level of a new context is DMI_LOG_DEBUG, so that every message reaches the handler.

Parameters

context

Context to set the level of.

level

Least severe level of the messages written.

Return value

Returns true, or false if context is nullptr or level is DMI_LOG_INVALID.

Errors

None.