Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQmlJSLogger Class Reference

#include <qqmljslogger_p.h>

Collaboration diagram for QQmlJSLogger:

Public Member Functions

QList< QQmlJS::LoggerCategorycategories () const
void registerCategory (const QQmlJS::LoggerCategory &category)
 QQmlJSLogger ()
 ~QQmlJSLogger ()=default
bool hasWarnings () const
bool hasErrors () const
qsizetype numWarnings () const
qsizetype numErrors () const
template<typename F>
void iterateCurrentFunctionMessages (F &&f) const
template<typename F>
void iterateAllMessages (F &&f) const
QtMsgType categoryLevel (QQmlJS::LoggerWarningId id) const
void setCategoryLevel (QQmlJS::LoggerWarningId id, QtMsgType level)
bool isCategoryIgnored (QQmlJS::LoggerWarningId id) const
void setCategoryIgnored (QQmlJS::LoggerWarningId id, bool error)
bool isCategoryFatal (QQmlJS::LoggerWarningId id) const
void setCategoryFatal (QQmlJS::LoggerWarningId id, bool error)
bool wasCategoryChanged (QQmlJS::LoggerWarningId id) const
QtMsgType compileErrorLevel () const
void setCompileErrorLevel (QtMsgType level)
QString compileErrorPrefix () const
void setCompileErrorPrefix (const QString &prefix)
QString compileSkipPrefix () const
void setCompileSkipPrefix (const QString &prefix)
void log (const QString &message, QQmlJS::LoggerWarningId id, const QQmlJS::SourceLocation &srcLocation, bool showContext=true, bool showFileName=true, const std::optional< QQmlJSFixSuggestion > &suggestion={}, const QString overrideFileName=QString(), std::optional< quint32 > customLineForDisabling=std::nullopt)
void logCompileError (const QString &message, const QQmlJS::SourceLocation &srcLocation)
void logCompileSkip (const QString &message, const QQmlJS::SourceLocation &srcLocation)
void processMessages (const QList< QQmlJS::DiagnosticMessage > &messages, const QQmlJS::LoggerWarningId id, const QQmlJS::SourceLocation &sourceLocation=QQmlJS::SourceLocation{})
void ignoreWarnings (uint32_t line, const QSet< QString > &categories)
void setSilent (bool silent)
bool isSilent () const
void setIsDisabled (bool isDisabled)
bool isDisabled () const
void setCode (const QString &code)
QString code () const
void setFilePath (const QString &filePath)
QString filePath () const
bool currentFunctionHasCompileError () const
bool currentFunctionWasSkipped () const
bool currentFunctionHasErrorOrSkip () const
QString currentFunctionCompileErrorMessage () const
QString currentFunctionCompileSkipMessage () const
void startTransaction ()
void commit ()
void rollback ()
void finalizeFuction ()

Static Public Member Functions

static const QList< QQmlJS::LoggerCategory > & defaultCategories ()

Detailed Description

Definition at line 121 of file qqmljslogger_p.h.

Constructor & Destructor Documentation

◆ QQmlJSLogger()

QQmlJSLogger::QQmlJSLogger ( )

Definition at line 197 of file qqmljslogger.cpp.

◆ ~QQmlJSLogger()

QQmlJSLogger::~QQmlJSLogger ( )
default

Member Function Documentation

◆ categories()

QList< QQmlJS::LoggerCategory > QQmlJSLogger::categories ( ) const

Definition at line 235 of file qqmljslogger.cpp.

◆ categoryLevel()

QtMsgType QQmlJSLogger::categoryLevel ( QQmlJS::LoggerWarningId id) const
inline

Definition at line 156 of file qqmljslogger_p.h.

◆ code()

QString QQmlJSLogger::code ( ) const
inline

Definition at line 286 of file qqmljslogger_p.h.

◆ commit()

void QQmlJSLogger::commit ( )

Commit the current transaction. Print all pending messages, and add them to the list of committed messages. Then, clear the transaction flag.

Definition at line 375 of file qqmljslogger.cpp.

◆ compileErrorLevel()

QtMsgType QQmlJSLogger::compileErrorLevel ( ) const
inline

Definition at line 191 of file qqmljslogger_p.h.

◆ compileErrorPrefix()

QString QQmlJSLogger::compileErrorPrefix ( ) const
inline

Definition at line 194 of file qqmljslogger_p.h.

◆ compileSkipPrefix()

QString QQmlJSLogger::compileSkipPrefix ( ) const
inline

Definition at line 197 of file qqmljslogger_p.h.

◆ currentFunctionCompileErrorMessage()

QString QQmlJSLogger::currentFunctionCompileErrorMessage ( ) const
inline

Definition at line 306 of file qqmljslogger_p.h.

◆ currentFunctionCompileSkipMessage()

QString QQmlJSLogger::currentFunctionCompileSkipMessage ( ) const
inline

Definition at line 316 of file qqmljslogger_p.h.

◆ currentFunctionHasCompileError()

bool QQmlJSLogger::currentFunctionHasCompileError ( ) const
inline

Definition at line 291 of file qqmljslogger_p.h.

Referenced by currentFunctionHasErrorOrSkip().

Here is the caller graph for this function:

◆ currentFunctionHasErrorOrSkip()

bool QQmlJSLogger::currentFunctionHasErrorOrSkip ( ) const
inline

Definition at line 301 of file qqmljslogger_p.h.

References currentFunctionHasCompileError(), and currentFunctionWasSkipped().

Here is the call graph for this function:

◆ currentFunctionWasSkipped()

bool QQmlJSLogger::currentFunctionWasSkipped ( ) const
inline

Definition at line 296 of file qqmljslogger_p.h.

Referenced by currentFunctionHasErrorOrSkip().

Here is the caller graph for this function:

◆ defaultCategories()

const QList< QQmlJS::LoggerCategory > & QQmlJSLogger::defaultCategories ( )
static

Definition at line 211 of file qqmljslogger.cpp.

◆ filePath()

QString QQmlJSLogger::filePath ( ) const
inline

Definition at line 289 of file qqmljslogger_p.h.

◆ finalizeFuction()

void QQmlJSLogger::finalizeFuction ( )

Definition at line 346 of file qqmljslogger.cpp.

◆ hasErrors()

bool QQmlJSLogger::hasErrors ( ) const
inline

Definition at line 134 of file qqmljslogger_p.h.

◆ hasWarnings()

bool QQmlJSLogger::hasWarnings ( ) const
inline

Definition at line 133 of file qqmljslogger_p.h.

◆ ignoreWarnings()

void QQmlJSLogger::ignoreWarnings ( uint32_t line,
const QSet< QString > & categories )
inline

Definition at line 265 of file qqmljslogger_p.h.

◆ isCategoryFatal()

bool QQmlJSLogger::isCategoryFatal ( QQmlJS::LoggerWarningId id) const
inline

Definition at line 176 of file qqmljslogger_p.h.

◆ isCategoryIgnored()

bool QQmlJSLogger::isCategoryIgnored ( QQmlJS::LoggerWarningId id) const
inline

Definition at line 166 of file qqmljslogger_p.h.

◆ isDisabled()

bool QQmlJSLogger::isDisabled ( ) const
inline

Definition at line 283 of file qqmljslogger_p.h.

◆ isSilent()

bool QQmlJSLogger::isSilent ( ) const
inline

Definition at line 271 of file qqmljslogger_p.h.

◆ iterateAllMessages()

template<typename F>
void QQmlJSLogger::iterateAllMessages ( F && f) const
inline

Definition at line 147 of file qqmljslogger_p.h.

◆ iterateCurrentFunctionMessages()

template<typename F>
void QQmlJSLogger::iterateCurrentFunctionMessages ( F && f) const
inline

Definition at line 140 of file qqmljslogger_p.h.

◆ log()

void QQmlJSLogger::log ( const QString & message,
QQmlJS::LoggerWarningId id,
const QQmlJS::SourceLocation & srcLocation,
bool showContext = true,
bool showFileName = true,
const std::optional< QQmlJSFixSuggestion > & suggestion = {},
const QString overrideFileName = QString(),
std::optional< quint32 > customLineForDisabling = std::nullopt )
inline

Logs message with severity deduced from category. Prefer using this function in most cases.

See also
setCategoryLevel

Definition at line 207 of file qqmljslogger_p.h.

◆ logCompileError()

void QQmlJSLogger::logCompileError ( const QString & message,
const QQmlJS::SourceLocation & srcLocation )
inline

Definition at line 226 of file qqmljslogger_p.h.

◆ logCompileSkip()

void QQmlJSLogger::logCompileSkip ( const QString & message,
const QQmlJS::SourceLocation & srcLocation )
inline

Definition at line 246 of file qqmljslogger_p.h.

◆ numErrors()

qsizetype QQmlJSLogger::numErrors ( ) const
inline

Definition at line 137 of file qqmljslogger_p.h.

◆ numWarnings()

qsizetype QQmlJSLogger::numWarnings ( ) const
inline

Definition at line 136 of file qqmljslogger_p.h.

◆ processMessages()

void QQmlJSLogger::processMessages ( const QList< QQmlJS::DiagnosticMessage > & messages,
const QQmlJS::LoggerWarningId id,
const QQmlJS::SourceLocation & sourceLocation = QQmlJS::SourceLocation{} )

Definition at line 329 of file qqmljslogger.cpp.

◆ registerCategory()

void QQmlJSLogger::registerCategory ( const QQmlJS::LoggerCategory & category)

Definition at line 240 of file qqmljslogger.cpp.

◆ rollback()

void QQmlJSLogger::rollback ( )

Roll back the current transaction and revert the logger to the state before it was started.

Definition at line 392 of file qqmljslogger.cpp.

◆ setCategoryFatal()

void QQmlJSLogger::setCategoryFatal ( QQmlJS::LoggerWarningId id,
bool error )
inline

Definition at line 180 of file qqmljslogger_p.h.

◆ setCategoryIgnored()

void QQmlJSLogger::setCategoryIgnored ( QQmlJS::LoggerWarningId id,
bool error )
inline

Definition at line 170 of file qqmljslogger_p.h.

◆ setCategoryLevel()

void QQmlJSLogger::setCategoryLevel ( QQmlJS::LoggerWarningId id,
QtMsgType level )
inline

Definition at line 160 of file qqmljslogger_p.h.

◆ setCode()

void QQmlJSLogger::setCode ( const QString & code)
inline

Definition at line 285 of file qqmljslogger_p.h.

◆ setCompileErrorLevel()

void QQmlJSLogger::setCompileErrorLevel ( QtMsgType level)
inline

Definition at line 192 of file qqmljslogger_p.h.

◆ setCompileErrorPrefix()

void QQmlJSLogger::setCompileErrorPrefix ( const QString & prefix)
inline

Definition at line 195 of file qqmljslogger_p.h.

◆ setCompileSkipPrefix()

void QQmlJSLogger::setCompileSkipPrefix ( const QString & prefix)
inline

Definition at line 198 of file qqmljslogger_p.h.

◆ setFilePath()

void QQmlJSLogger::setFilePath ( const QString & filePath)
inline

Definition at line 288 of file qqmljslogger_p.h.

◆ setIsDisabled()

void QQmlJSLogger::setIsDisabled ( bool isDisabled)
inline

The logger is disabled when warnings are not relevant, for example when the import visitor runs on a dependency of a linted file. In that case, the warnings should not be created, and expensive QQmlJSUtils::didYouMean call can be saved.

setSilent() has a different behavior: a silent logger can still be used to process messages as JSON, for example, while a disabled logger won't contain any message.

Definition at line 282 of file qqmljslogger_p.h.

◆ setSilent()

void QQmlJSLogger::setSilent ( bool silent)
inline

Definition at line 270 of file qqmljslogger_p.h.

◆ startTransaction()

void QQmlJSLogger::startTransaction ( )

Starts a transaction for a compile pass. This buffers all messages until the transaction completes. If you commit the transaction, the messages are printed and added to the list of committed messages. If you roll it back, the logger reverts to the state before the start of the transaction.

This is useful for compile passes that potentially have to be repeated, such as the type propagator. We don't want to see the same messages logged multiple times.

Definition at line 364 of file qqmljslogger.cpp.

◆ wasCategoryChanged()

bool QQmlJSLogger::wasCategoryChanged ( QQmlJS::LoggerWarningId id) const
inline

Definition at line 186 of file qqmljslogger_p.h.


The documentation for this class was generated from the following files: