#[repr(C)]
pub struct QLoggingCategory { /* private fields */ }
Expand description

The QLoggingCategory class represents a category, or 'area' in the logging infrastructure.

C++ class: QLoggingCategory.

C++ documentation:

The QLoggingCategory class represents a category, or ‘area’ in the logging infrastructure.

QLoggingCategory represents a certain logging category - identified by a string - at runtime. A category can be configured to enable or disable logging of messages per message type. Whether a message type is enabled or not can be checked with the isDebugEnabled(), isInfoEnabled(), isWarningEnabled(), and isCriticalEnabled() methods.

All objects are meant to be configured by a common registry (see also Configuring Categories). Different objects can also represent the same category. It is therefore not recommended to export objects across module boundaries, nor to manipulate the objects directly, nor to inherit from QLoggingCategory.

Implementations§

source§

impl QLoggingCategory

source

pub unsafe fn call_mut(&self) -> Ref<QLoggingCategory>

Returns the object itself. This allows both a QLoggingCategory variable, and a factory method returning a QLoggingCategory, to be used in qCDebug(), qCWarning(), qCCritical() macros.

Calls C++ function: QLoggingCategory& QLoggingCategory::operator()().

C++ documentation:

Returns the object itself. This allows both a QLoggingCategory variable, and a factory method returning a QLoggingCategory, to be used in qCDebug(), qCWarning(), qCCritical() macros.

source

pub unsafe fn call(&self) -> Ref<QLoggingCategory>

Returns the object itself. This allows both a QLoggingCategory variable, and a factory method returning a QLoggingCategory, to be used in qCDebug(), qCWarning(), qCCritical() macros.

Calls C++ function: const QLoggingCategory& QLoggingCategory::operator()() const.

C++ documentation:

Returns the object itself. This allows both a QLoggingCategory variable, and a factory method returning a QLoggingCategory, to be used in qCDebug(), qCWarning(), qCCritical() macros.

source

pub unsafe fn category_name(&self) -> *const c_char

Returns the name of the category.

Calls C++ function: const char* QLoggingCategory::categoryName() const.

C++ documentation:

Returns the name of the category.

source

pub unsafe fn default_category() -> Ptr<QLoggingCategory>

Returns a pointer to the global category "default" that is used e.g. by qDebug(), qInfo(), qWarning(), qCritical(), qFatal().

Calls C++ function: static QLoggingCategory* QLoggingCategory::defaultCategory().

C++ documentation:

Returns a pointer to the global category “default” that is used e.g. by qDebug(), qInfo(), qWarning(), qCritical(), qFatal().

Note: The returned pointer may be null during destruction of static objects.

Note: Ownership of the category is not transferred, do not delete the returned pointer.

source

pub unsafe fn install_filter( arg1: Option<extern "C" fn(_: *mut QLoggingCategory)> ) -> Option<extern "C" fn(_: *mut QLoggingCategory)>

Installs a function filter that is used to determine which categories and message types should be enabled. Returns a pointer to the previous installed filter.

Calls C++ function: static void (*FN_PTR)(QLoggingCategory *) QLoggingCategory::installFilter(void (*FN_PTR)(QLoggingCategory *) arg1).

C++ documentation:

Installs a function filter that is used to determine which categories and message types should be enabled. Returns a pointer to the previous installed filter.

Every QLoggingCategory object created is passed to the filter, and the filter is free to change the respective category configuration with setEnabled().

The filter might be called from different threads, but never concurrently. The filter shall not call any static functions of QLoggingCategory.

Example:

QLoggingCategory::CategoryFilter oldCategoryFilter;

void myCategoryFilter(QLoggingCategory *category) { // configure driver.usb category here, otherwise forward to to default filter. if (qstrcmp(category->categoryName(), “driver.usb”) == 0) category->setEnabled(QtDebugMsg, true); else oldCategoryFilter(category); }

An alternative way of configuring the default filter is via setFilterRules().

source

pub unsafe fn is_critical_enabled(&self) -> bool

Returns true if critical messages should be shown for this category. Returns false otherwise.

Calls C++ function: bool QLoggingCategory::isCriticalEnabled() const.

C++ documentation:

Returns true if critical messages should be shown for this category. Returns false otherwise.

Note: The qCCritical() macro already does this check before executing any code. However, calling this method may be useful to avoid expensive generation of data that is only used for debug output.

source

pub unsafe fn is_debug_enabled(&self) -> bool

Returns true if debug messages should be shown for this category. Returns false otherwise.

Calls C++ function: bool QLoggingCategory::isDebugEnabled() const.

C++ documentation:

Returns true if debug messages should be shown for this category. Returns false otherwise.

Note: The qCDebug() macro already does this check before executing any code. However, calling this method may be useful to avoid expensive generation of data that is only used for debug output.

source

pub unsafe fn is_enabled(&self, type_: QtMsgType) -> bool

Returns true if a message of type msgtype for the category should be shown. Returns false otherwise.

Calls C++ function: bool QLoggingCategory::isEnabled(QtMsgType type) const.

C++ documentation:

Returns true if a message of type msgtype for the category should be shown. Returns false otherwise.

source

pub unsafe fn is_info_enabled(&self) -> bool

Returns true if informational messages should be shown for this category. Returns false otherwise.

Calls C++ function: bool QLoggingCategory::isInfoEnabled() const.

C++ documentation:

Returns true if informational messages should be shown for this category. Returns false otherwise.

Note: The qCInfo() macro already does this check before executing any code. However, calling this method may be useful to avoid expensive generation of data that is only used for debug output.

This function was introduced in Qt 5.5.

source

pub unsafe fn is_warning_enabled(&self) -> bool

Returns true if warning messages should be shown for this category. Returns false otherwise.

Calls C++ function: bool QLoggingCategory::isWarningEnabled() const.

C++ documentation:

Returns true if warning messages should be shown for this category. Returns false otherwise.

Note: The qCWarning() macro already does this check before executing any code. However, calling this method may be useful to avoid expensive generation of data that is only used for debug output.

source

pub unsafe fn new_1a(category: *const c_char) -> CppBox<QLoggingCategory>

Constructs a QLoggingCategory object with the provided category name. All message types for this category are enabled by default.

Calls C++ function: [constructor] void QLoggingCategory::QLoggingCategory(const char* category).

C++ documentation:

Constructs a QLoggingCategory object with the provided category name. All message types for this category are enabled by default.

If category is 0, the category name is changed to "default".

source

pub unsafe fn new_2a( category: *const c_char, severity_level: QtMsgType ) -> CppBox<QLoggingCategory>

Constructs a QLoggingCategory object with the provided category name, and enables all messages with types more severe or equal than enableForLevel.

Calls C++ function: [constructor] void QLoggingCategory::QLoggingCategory(const char* category, QtMsgType severityLevel).

C++ documentation:

Constructs a QLoggingCategory object with the provided category name, and enables all messages with types more severe or equal than enableForLevel.

If category is 0, the category name is changed to "default".

This function was introduced in Qt 5.4.

source

pub unsafe fn set_enabled(&self, type_: QtMsgType, enable: bool)

Changes the message type type for the category to enable.

Calls C++ function: void QLoggingCategory::setEnabled(QtMsgType type, bool enable).

C++ documentation:

Changes the message type type for the category to enable.

This method is meant to be used only from inside a filter installed by installFilter(). See Configuring Categories for an overview on how to configure categories globally.

Note: QtFatalMsg cannot be changed. It will always remain true.

See also isEnabled().

source

pub unsafe fn set_filter_rules(rules: impl CastInto<Ref<QString>>)

Configures which categories and message types should be enabled through a a set of rules.

Calls C++ function: static void QLoggingCategory::setFilterRules(const QString& rules).

C++ documentation:

Configures which categories and message types should be enabled through a a set of rules.

Example:

QLoggingCategory::setFilterRules(QStringLiteral(“driver.usb.debug=true”));

Note: The rules might be ignored if a custom category filter is installed with installFilter(), or if the user defined QT_LOGGING_CONF or QT_LOGGING_RULES environment variable.

Trait Implementations§

source§

impl CppDeletable for QLoggingCategory

source§

unsafe fn delete(&self)

Destructs a QLoggingCategory object.

Calls C++ function: [destructor] void QLoggingCategory::~QLoggingCategory().

C++ documentation:

Destructs a QLoggingCategory object.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.