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
QQmlJS::WarningSeverity categorySeverity (QQmlJS::LoggerWarningId id) const
void setCategorySeverity (QQmlJS::LoggerWarningId id, QQmlJS::WarningSeverity severity)
bool wasCategoryChanged (QQmlJS::LoggerWarningId id) const
QQmlJS::WarningSeverity compileErrorSeverity () const
void setCompileErrorSeverity (QQmlJS::WarningSeverity severity)
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={}, 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 (QSpan< const 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 finalizeFunction ()

Static Public Member Functions

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

Detailed Description

Definition at line 117 of file qqmljslogger_p.h.

Constructor & Destructor Documentation

◆ QQmlJSLogger()

QQmlJSLogger::QQmlJSLogger ( )

Definition at line 214 of file qqmljslogger.cpp.

◆ ~QQmlJSLogger()

QQmlJSLogger::~QQmlJSLogger ( )
default

Member Function Documentation

◆ builtinCategories()

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

Definition at line 228 of file qqmljslogger.cpp.

◆ categories()

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

Definition at line 252 of file qqmljslogger.cpp.

◆ categorySeverity()

QQmlJS::WarningSeverity QQmlJSLogger::categorySeverity ( QQmlJS::LoggerWarningId id) const
inline

Definition at line 152 of file qqmljslogger_p.h.

◆ code()

QString QQmlJSLogger::code ( ) const
inline

Definition at line 271 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 387 of file qqmljslogger.cpp.

◆ compileErrorPrefix()

QString QQmlJSLogger::compileErrorPrefix ( ) const
inline

Definition at line 170 of file qqmljslogger_p.h.

◆ compileErrorSeverity()

QQmlJS::WarningSeverity QQmlJSLogger::compileErrorSeverity ( ) const
inline

Definition at line 167 of file qqmljslogger_p.h.

◆ compileSkipPrefix()

QString QQmlJSLogger::compileSkipPrefix ( ) const
inline

Definition at line 173 of file qqmljslogger_p.h.

◆ currentFunctionCompileErrorMessage()

QString QQmlJSLogger::currentFunctionCompileErrorMessage ( ) const
inline

Definition at line 291 of file qqmljslogger_p.h.

◆ currentFunctionCompileSkipMessage()

QString QQmlJSLogger::currentFunctionCompileSkipMessage ( ) const
inline

Definition at line 301 of file qqmljslogger_p.h.

◆ currentFunctionHasCompileError()

bool QQmlJSLogger::currentFunctionHasCompileError ( ) const
inline

Definition at line 276 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 286 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 281 of file qqmljslogger_p.h.

Referenced by currentFunctionHasErrorOrSkip().

Here is the caller graph for this function:

◆ filePath()

QString QQmlJSLogger::filePath ( ) const
inline

Definition at line 274 of file qqmljslogger_p.h.

◆ finalizeFunction()

void QQmlJSLogger::finalizeFunction ( )

Definition at line 358 of file qqmljslogger.cpp.

◆ hasErrors()

bool QQmlJSLogger::hasErrors ( ) const
inline

Definition at line 130 of file qqmljslogger_p.h.

◆ hasWarnings()

bool QQmlJSLogger::hasWarnings ( ) const
inline

Definition at line 129 of file qqmljslogger_p.h.

◆ ignoreWarnings()

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

Definition at line 250 of file qqmljslogger_p.h.

◆ isDisabled()

bool QQmlJSLogger::isDisabled ( ) const
inline

Definition at line 268 of file qqmljslogger_p.h.

◆ isSilent()

bool QQmlJSLogger::isSilent ( ) const
inline

Definition at line 256 of file qqmljslogger_p.h.

◆ iterateAllMessages()

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

Definition at line 143 of file qqmljslogger_p.h.

◆ iterateCurrentFunctionMessages()

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

Definition at line 136 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 = {},
std::optional< quint32 > customLineForDisabling = std::nullopt )
inline

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

See also
setCategorySeverity

Definition at line 183 of file qqmljslogger_p.h.

◆ logCompileError()

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

Definition at line 205 of file qqmljslogger_p.h.

◆ logCompileSkip()

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

Definition at line 228 of file qqmljslogger_p.h.

◆ numErrors()

qsizetype QQmlJSLogger::numErrors ( ) const
inline

Definition at line 133 of file qqmljslogger_p.h.

◆ numWarnings()

qsizetype QQmlJSLogger::numWarnings ( ) const
inline

Definition at line 132 of file qqmljslogger_p.h.

◆ processMessages()

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

Definition at line 341 of file qqmljslogger.cpp.

◆ registerCategory()

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

Definition at line 257 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 404 of file qqmljslogger.cpp.

◆ setCategorySeverity()

void QQmlJSLogger::setCategorySeverity ( QQmlJS::LoggerWarningId id,
QQmlJS::WarningSeverity severity )
inline

Definition at line 156 of file qqmljslogger_p.h.

◆ setCode()

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

Definition at line 270 of file qqmljslogger_p.h.

◆ setCompileErrorPrefix()

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

Definition at line 171 of file qqmljslogger_p.h.

◆ setCompileErrorSeverity()

void QQmlJSLogger::setCompileErrorSeverity ( QQmlJS::WarningSeverity severity)
inline

Definition at line 168 of file qqmljslogger_p.h.

◆ setCompileSkipPrefix()

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

Definition at line 174 of file qqmljslogger_p.h.

◆ setFilePath()

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

Definition at line 273 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 267 of file qqmljslogger_p.h.

◆ setSilent()

void QQmlJSLogger::setSilent ( bool silent)
inline

Definition at line 255 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 376 of file qqmljslogger.cpp.

◆ wasCategoryChanged()

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

Definition at line 162 of file qqmljslogger_p.h.


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