TSDuck  v3.35-3218
MPEG Transport Stream Toolkit
ts::ReportWithPrefix Class Reference

An encapsulation of Report with a message prefix. More...

Inheritance diagram for ts::ReportWithPrefix:
Collaboration diagram for ts::ReportWithPrefix:

Public Member Functions

 ReportWithPrefix (Report &report, const UString &prefix=UString())
 Constructor. More...
 
bool debug () const
 Check if debugging is active. More...
 
void debug (const UChar *fmt, std::initializer_list< ArgMixIn > args)
 Report a debug message with a printf-like interface. More...
 
void debug (const UString &fmt, std::initializer_list< ArgMixIn > args)
 Report a debug message with a printf-like interface. More...
 
void debug (const UString &msg)
 Report a debug message. More...
 
void error (const UChar *fmt, std::initializer_list< ArgMixIn > args)
 Report an error message with a printf-like interface. More...
 
void error (const UString &fmt, std::initializer_list< ArgMixIn > args)
 Report an error message with a printf-like interface. More...
 
void error (const UString &msg)
 Report an error message. More...
 
void fatal (const UChar *fmt, std::initializer_list< ArgMixIn > args)
 Report a fatal error message with a printf-like interface. More...
 
void fatal (const UString &fmt, std::initializer_list< ArgMixIn > args)
 Report a fatal error message with a printf-like interface. More...
 
void fatal (const UString &msg)
 Report a fatal error message. More...
 
bool gotErrors () const
 Check if errors (or worse) were reported through this object. More...
 
void info (const UChar *fmt, std::initializer_list< ArgMixIn > args)
 Report an informational message with a printf-like interface. More...
 
void info (const UString &fmt, std::initializer_list< ArgMixIn > args)
 Report an informational message with a printf-like interface. More...
 
void info (const UString &msg)
 Report an informational message. More...
 
virtual void log (int severity, const UChar *fmt, std::initializer_list< ArgMixIn > args)
 Report a message with an explicit severity and a printf-like interface. More...
 
virtual void log (int severity, const UString &fmt, std::initializer_list< ArgMixIn > args)
 Report a message with an explicit severity and a printf-like interface. More...
 
virtual void log (int severity, const UString &msg)
 Report a message with an explicit severity. More...
 
int maxSeverity () const
 Get maximum severity level. More...
 
UString prefix () const
 Get the current prefix to display. More...
 
virtual void raiseMaxSeverity (int level)
 Raise maximum severity level. More...
 
void resetErrors ()
 Reset the error indicator. More...
 
virtual void setMaxSeverity (int level) override
 Set maximum severity level. More...
 
void setPrefix (const UString &prefix)
 Set the prefix to display. More...
 
void severe (const UChar *fmt, std::initializer_list< ArgMixIn > args)
 Report a severe error message with a printf-like interface. More...
 
void severe (const UString &fmt, std::initializer_list< ArgMixIn > args)
 Report a severe error message with a printf-like interface. More...
 
void severe (const UString &msg)
 Report a severe error message. More...
 
bool verbose () const
 Check if verbose reporting is active. More...
 
void verbose (const UChar *fmt, std::initializer_list< ArgMixIn > args)
 Report a verbose message with a printf-like interface. More...
 
void verbose (const UString &fmt, std::initializer_list< ArgMixIn > args)
 Report a verbose message with a printf-like interface. More...
 
void verbose (const UString &msg)
 Report a verbose message. More...
 
void warning (const UChar *fmt, std::initializer_list< ArgMixIn > args)
 Report a warning message with a printf-like interface. More...
 
void warning (const UString &fmt, std::initializer_list< ArgMixIn > args)
 Report a warning message with a printf-like interface. More...
 
void warning (const UString &msg)
 Report a warning message. More...
 

Protected Member Functions

virtual void writeLog (int severity, const UString &msg) override
 Actual message reporting method. More...
 

Protected Attributes

volatile int _max_severity
 Debug level is accessible to subclasses.
 

Detailed Description

An encapsulation of Report with a message prefix.

This class encapsulates another instance of Report and prepend all messages with a prefix.

Constructor & Destructor Documentation

◆ ReportWithPrefix()

ts::ReportWithPrefix::ReportWithPrefix ( Report report,
const UString prefix = UString() 
)
explicit

Constructor.

Parameters
[in]reportThe actual object which is used to report.
[in]prefixThe prefix to prepend to all messages.

Member Function Documentation

◆ prefix()

UString ts::ReportWithPrefix::prefix ( ) const
inline

Get the current prefix to display.

Returns
The current prefix to display.

◆ setPrefix()

void ts::ReportWithPrefix::setPrefix ( const UString prefix)
inline

Set the prefix to display.

Parameters
[in]prefixThe prefix to prepend to all messages.

◆ setMaxSeverity()

virtual void ts::ReportWithPrefix::setMaxSeverity ( int  level)
overridevirtual

Set maximum severity level.

Messages with higher severities are not reported.

Parameters
[in]levelSet report to that level.

Reimplemented from ts::Report.

◆ writeLog()

virtual void ts::ReportWithPrefix::writeLog ( int  severity,
const UString msg 
)
overrideprotectedvirtual

Actual message reporting method.

Must be implemented in actual classes. The method is called only when a message passed the severity filter. It is not necessary to recheck severity inside the method.

Parameters
[in]severityMessage severity.
[in]msgMessage text.

Implements ts::Report.

◆ raiseMaxSeverity()

virtual void ts::Report::raiseMaxSeverity ( int  level)
virtualinherited

Raise maximum severity level.

Parameters
[in]levelSet report at least to that level.

Reimplemented in ts::Args.

◆ maxSeverity()

int ts::Report::maxSeverity ( ) const
inlineinherited

Get maximum severity level.

Returns
Current maximum debug level.

◆ debug() [1/4]

bool ts::Report::debug ( ) const
inlineinherited

Check if debugging is active.

Returns
True if current reporting level is Debug or higher.

◆ debug() [2/4]

void ts::Report::debug ( const UString msg)
inlineinherited

Report a debug message.

Parameters
[in]msgMessage text.

◆ debug() [3/4]

void ts::Report::debug ( const UChar fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report a debug message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ debug() [4/4]

void ts::Report::debug ( const UString fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report a debug message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ verbose() [1/4]

bool ts::Report::verbose ( ) const
inlineinherited

Check if verbose reporting is active.

Returns
True if current reporting level is Verbose or higher.

◆ verbose() [2/4]

void ts::Report::verbose ( const UString msg)
inlineinherited

Report a verbose message.

Parameters
[in]msgMessage text.

◆ verbose() [3/4]

void ts::Report::verbose ( const UChar fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report a verbose message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ verbose() [4/4]

void ts::Report::verbose ( const UString fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report a verbose message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ log() [1/3]

virtual void ts::Report::log ( int  severity,
const UString msg 
)
virtualinherited

Report a message with an explicit severity.

This method is the central reporting point. If filters the severity and drops the message if severity is higher than maxSeverity().

Subclasses should override writeLog() to implement a specific reporting device. It is not necessary to override log() unless the subclass needs to implement a different severity filtering policy.

Parameters
[in]severityMessage severity.
[in]msgMessage text.

◆ log() [2/3]

virtual void ts::Report::log ( int  severity,
const UChar fmt,
std::initializer_list< ArgMixIn args 
)
virtualinherited

Report a message with an explicit severity and a printf-like interface.

Parameters
[in]severityMessage severity.
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ log() [3/3]

virtual void ts::Report::log ( int  severity,
const UString fmt,
std::initializer_list< ArgMixIn args 
)
virtualinherited

Report a message with an explicit severity and a printf-like interface.

Parameters
[in]severityMessage severity.
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ fatal() [1/3]

void ts::Report::fatal ( const UString msg)
inlineinherited

Report a fatal error message.

Parameters
[in]msgMessage text.

◆ fatal() [2/3]

void ts::Report::fatal ( const UChar fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report a fatal error message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ fatal() [3/3]

void ts::Report::fatal ( const UString fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report a fatal error message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ severe() [1/3]

void ts::Report::severe ( const UString msg)
inlineinherited

Report a severe error message.

Parameters
[in]msgMessage text.

◆ severe() [2/3]

void ts::Report::severe ( const UChar fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report a severe error message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ severe() [3/3]

void ts::Report::severe ( const UString fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report a severe error message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ error() [1/3]

void ts::Report::error ( const UString msg)
inlineinherited

Report an error message.

Parameters
[in]msgMessage text.

◆ error() [2/3]

void ts::Report::error ( const UChar fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report an error message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ error() [3/3]

void ts::Report::error ( const UString fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report an error message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ warning() [1/3]

void ts::Report::warning ( const UString msg)
inlineinherited

Report a warning message.

Parameters
[in]msgMessage text.

◆ warning() [2/3]

void ts::Report::warning ( const UChar fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report a warning message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ warning() [3/3]

void ts::Report::warning ( const UString fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report a warning message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ info() [1/3]

void ts::Report::info ( const UString msg)
inlineinherited

Report an informational message.

Parameters
[in]msgMessage text.

◆ info() [2/3]

void ts::Report::info ( const UChar fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report an informational message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ info() [3/3]

void ts::Report::info ( const UString fmt,
std::initializer_list< ArgMixIn args 
)
inlineinherited

Report an informational message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ gotErrors()

bool ts::Report::gotErrors ( ) const
inlineinherited

Check if errors (or worse) were reported through this object.

Returns
True if errors (or worse) were reported through this object.

◆ resetErrors()

void ts::Report::resetErrors ( )
inlineinherited

Reset the error indicator.

See also
gotErrors()

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