[−][src]Struct qt_core::QLoggingCategory
The QLoggingCategory class represents a category, or 'area' in the logging infrastructure.
C++ class: QLoggingCategory
.
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.
Methods
impl QLoggingCategory
[src]
pub unsafe fn call_mut(&self) -> Ref<QLoggingCategory>
[src]
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()()
.
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.
pub unsafe fn call(&self) -> Ref<QLoggingCategory>
[src]
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
.
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.
pub unsafe fn category_name(&self) -> *const c_char
[src]
Returns the name of the category.
Calls C++ function: const char* QLoggingCategory::categoryName() const
.
Returns the name of the category.
pub unsafe fn default_category() -> Ptr<QLoggingCategory>
[src]
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()
.
pub unsafe fn install_filter(
arg1: Option<extern "C" fn(_: *mut QLoggingCategory)>
) -> Option<extern "C" fn(_: *mut QLoggingCategory)>
[src]
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)
.
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().
pub unsafe fn is_critical_enabled(&self) -> bool
[src]
Returns true
if critical messages should be shown for this category. Returns false
otherwise.
Calls C++ function: bool QLoggingCategory::isCriticalEnabled() const
.
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.
pub unsafe fn is_debug_enabled(&self) -> bool
[src]
Returns true
if debug messages should be shown for this category. Returns false
otherwise.
Calls C++ function: bool QLoggingCategory::isDebugEnabled() const
.
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.
pub unsafe fn is_enabled(&self, type_: QtMsgType) -> bool
[src]
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
.
Returns true
if a message of type msgtype for the category should be shown. Returns false
otherwise.
pub unsafe fn is_info_enabled(&self) -> bool
[src]
Returns true
if informational messages should be shown for this category. Returns false
otherwise.
Calls C++ function: bool QLoggingCategory::isInfoEnabled() const
.
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.
pub unsafe fn is_warning_enabled(&self) -> bool
[src]
Returns true
if warning messages should be shown for this category. Returns false
otherwise.
Calls C++ function: bool QLoggingCategory::isWarningEnabled() const
.
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.
pub unsafe fn new_1a(category: *const c_char) -> CppBox<QLoggingCategory>
[src]
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)
.
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"
.
pub unsafe fn new_2a(
category: *const c_char,
severity_level: QtMsgType
) -> CppBox<QLoggingCategory>
[src]
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)
.
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.
pub unsafe fn set_enabled(&self, type_: QtMsgType, enable: bool)
[src]
Changes the message type type for the category to enable.
Calls C++ function: void QLoggingCategory::setEnabled(QtMsgType type, bool enable)
.
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().
pub unsafe fn set_filter_rules(rules: impl CastInto<Ref<QString>>)
[src]
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)
.
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
impl CppDeletable for QLoggingCategory
[src]
unsafe fn delete(&self)
[src]
Destructs a QLoggingCategory object.
Calls C++ function: [destructor] void QLoggingCategory::~QLoggingCategory()
.
Destructs a QLoggingCategory object.
Auto Trait Implementations
impl RefUnwindSafe for QLoggingCategory
impl Send for QLoggingCategory
impl Sync for QLoggingCategory
impl Unpin for QLoggingCategory
impl UnwindSafe for QLoggingCategory
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,