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

A singleton implementing Report on std::cerr without synchronization. More...

Inheritance diagram for ts::CerrReport:
Collaboration diagram for ts::CerrReport:

Public Member Functions

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...
 
virtual void raiseMaxSeverity (int level)
 Raise maximum severity level. More...
 
void resetErrors ()
 Reset the error indicator. More...
 
virtual void setMaxSeverity (int level)
 Set maximum severity level. 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...
 

Static Public Member Functions

static CerrReportInstance ()
 Get the instance of the singleton of this class. 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

A singleton implementing Report on std::cerr without synchronization.

If the environment variable TS_CERR_DEBUG_LEVEL is set to some integer value, it is used as initial maximum severity level for this object.

This class is a singleton. Use static Instance() method to access the single instance.

Member Function Documentation

◆ Instance()

static CerrReport* ts::CerrReport::Instance ( )
static

Get the instance of the singleton of this class.

Returns
The instance of the singleton of this class.

◆ writeLog()

virtual void ts::CerrReport::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.

◆ setMaxSeverity()

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

Set maximum severity level.

Messages with higher severities are not reported.

Parameters
[in]levelSet report to that level.

Reimplemented in ts::ReportWithPrefix.

◆ 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: