Struct qt_core::QMessageLogger

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

The QMessageLogger class generates log messages.

C++ class: QMessageLogger.

C++ documentation:

The QMessageLogger class generates log messages.

QMessageLogger is used to generate messages for the Qt logging framework. Usually one uses it through qDebug(), qInfo(), qWarning(), qCritical, or qFatal() functions, which are actually macros: For example qDebug() expands to QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).debug() for debug builds, and QMessageLogger(0, 0, 0).debug() for release builds.

One example of direct use is to forward errors that stem from a scripting language, e.g. QML:

void statusChanged(QDeclarativeComponent::Status status) { if (status == QDeclarativeComponent::Error) { foreach (const QDeclarativeError &error, component->errors()) { const QByteArray file = error.url().toEncoded(); QMessageLogger(file.constData(), error.line(), 0).debug() << error.description(); } } }

Implementations§

source§

impl QMessageLogger

source

pub unsafe fn critical_0a(&self) -> CppBox<QDebug>

Logs a critical message using a QDebug stream

Calls C++ function: QDebug QMessageLogger::critical() const.

C++ documentation:

Logs a critical message using a QDebug stream

See also qCritical() and QDebug.

source

pub unsafe fn critical_1a( &self, cat: impl CastInto<Ref<QLoggingCategory>> ) -> CppBox<QDebug>

Logs a critical message into category cat using a QDebug stream.

Calls C++ function: QDebug QMessageLogger::critical(const QLoggingCategory& cat) const.

C++ documentation:

Logs a critical message into category cat using a QDebug stream.

This function was introduced in Qt 5.3.

See also qCCritical() and QDebug.

source

pub unsafe fn debug_0a(&self) -> CppBox<QDebug>

Logs a debug message using a QDebug stream

Calls C++ function: QDebug QMessageLogger::debug() const.

C++ documentation:

Logs a debug message using a QDebug stream

See also qDebug() and QDebug.

source

pub unsafe fn debug_1a( &self, cat: impl CastInto<Ref<QLoggingCategory>> ) -> CppBox<QDebug>

Logs a debug message into category cat using a QDebug stream.

Calls C++ function: QDebug QMessageLogger::debug(const QLoggingCategory& cat) const.

C++ documentation:

Logs a debug message into category cat using a QDebug stream.

This function was introduced in Qt 5.3.

See also qCDebug() and QDebug.

source

pub unsafe fn info_0a(&self) -> CppBox<QDebug>

Logs an informational message using a QDebug stream.

Calls C++ function: QDebug QMessageLogger::info() const.

C++ documentation:

Logs an informational message using a QDebug stream.

This function was introduced in Qt 5.5.

See also qInfo() and QDebug.

source

pub unsafe fn info_1a( &self, cat: impl CastInto<Ref<QLoggingCategory>> ) -> CppBox<QDebug>

Logs an informational message into the category cat using a QDebug stream.

Calls C++ function: QDebug QMessageLogger::info(const QLoggingCategory& cat) const.

C++ documentation:

Logs an informational message into the category cat using a QDebug stream.

This function was introduced in Qt 5.5.

See also qCInfo() and QDebug.

source

pub unsafe fn new_0a() -> CppBox<QMessageLogger>

Constructs a default QMessageLogger. See the other constructors to specify context information.

Calls C++ function: [constructor] void QMessageLogger::QMessageLogger().

C++ documentation:

Constructs a default QMessageLogger. See the other constructors to specify context information.

source

pub unsafe fn new_3a( file: *const c_char, line: c_int, function: *const c_char ) -> CppBox<QMessageLogger>

Constructs a QMessageLogger to record log messages for file at line in function. The is equivalent to QMessageLogger(file, line, function, "default")

Calls C++ function: [constructor] void QMessageLogger::QMessageLogger(const char* file, int line, const char* function).

C++ documentation:

Constructs a QMessageLogger to record log messages for file at line in function. The is equivalent to QMessageLogger(file, line, function, “default”)

source

pub unsafe fn new_4a( file: *const c_char, line: c_int, function: *const c_char, category: *const c_char ) -> CppBox<QMessageLogger>

Constructs a QMessageLogger to record category messages for file at line in function.

Calls C++ function: [constructor] void QMessageLogger::QMessageLogger(const char* file, int line, const char* function, const char* category).

C++ documentation:

Constructs a QMessageLogger to record category messages for file at line in function.

source

pub unsafe fn warning_0a(&self) -> CppBox<QDebug>

Logs a warning message using a QDebug stream

Calls C++ function: QDebug QMessageLogger::warning() const.

C++ documentation:

Logs a warning message using a QDebug stream

See also qWarning() and QDebug.

source

pub unsafe fn warning_1a( &self, cat: impl CastInto<Ref<QLoggingCategory>> ) -> CppBox<QDebug>

Logs a warning message into category cat using a QDebug stream.

Calls C++ function: QDebug QMessageLogger::warning(const QLoggingCategory& cat) const.

C++ documentation:

Logs a warning message into category cat using a QDebug stream.

See also qCWarning() and QDebug.

Trait Implementations§

source§

impl CppDeletable for QMessageLogger

source§

unsafe fn delete(&self)

The QMessageLogger class generates log messages.

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

C++ documentation:

The QMessageLogger class generates log messages.

QMessageLogger is used to generate messages for the Qt logging framework. Usually one uses it through qDebug(), qInfo(), qWarning(), qCritical, or qFatal() functions, which are actually macros: For example qDebug() expands to QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).debug() for debug builds, and QMessageLogger(0, 0, 0).debug() for release builds.

One example of direct use is to forward errors that stem from a scripting language, e.g. QML:

void statusChanged(QDeclarativeComponent::Status status) { if (status == QDeclarativeComponent::Error) { foreach (const QDeclarativeError &error, component->errors()) { const QByteArray file = error.url().toEncoded(); QMessageLogger(file.constData(), error.line(), 0).debug() << error.description(); } } }

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.