![]() |
TSDuck
v3.35-3218
MPEG Transport Stream Toolkit
|
A subclass of ts::Report which outputs messages in a text file. More...
Public Member Functions | |
ReportFile (const UString &file_name, bool append=false, int max_severity=Severity::Info) | |
Constructor using a named file. More... | |
ReportFile (std::ostream &stream, int max_severity=0) | |
Constructor using an open file stream. More... | |
virtual | ~ReportFile () override |
Destructor. | |
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... | |
Protected Member Functions | |
virtual void | writeLog (int severity, const UString &message) override |
Actual message reporting method. More... | |
Protected Attributes | |
volatile int | _max_severity |
Debug level is accessible to subclasses. | |
A subclass of ts::Report which outputs messages in a text file.
Reentrancy is supported though the template parameter MUTEX.
MUTEX | A subclass of ts::MutexInterface which is used to serialize access to the file. By default, the class ts::NullMutex is used, meaning that there is no synchronization on the file. Multi-threaded applications must use an appropriate mutex class, typically ts::Mutex. |
ts::ReportFile< MUTEX >::ReportFile | ( | const UString & | file_name, |
bool | append = false , |
||
int | max_severity = Severity::Info |
||
) |
Constructor using a named file.
[in] | file_name | The name of the file to create. If the file creation fails, a fatal error is generated with an error message on std::cerr. The file will be closed when this object is destroyed. |
[in] | append | If true, append the messages at the end of the file. If false (the default), overwrite the file if it already existed. |
[in] | max_severity | Maximum debug level to display. None by default. |
ts::ReportFile< MUTEX >::ReportFile | ( | std::ostream & | stream, |
int | max_severity = 0 |
||
) |
Constructor using an open file stream.
[in,out] | stream | A reference to an open output file stream to log the messages. The corresponding stream object must remain valid as long as this object exists. Typical valid values are std::cout and std::cerr. |
[in] | max_severity | Maximum debug level to display. None by default. |
|
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.
[in] | severity | Message severity. |
[in] | msg | Message text. |
Implements ts::Report.
|
virtualinherited |
Set maximum severity level.
Messages with higher severities are not reported.
[in] | level | Set report to that level. |
Reimplemented in ts::ReportWithPrefix.
|
virtualinherited |
Raise maximum severity level.
[in] | level | Set report at least to that level. |
Reimplemented in ts::Args.
|
inlineinherited |
Get maximum severity level.
|
inlineinherited |
Check if debugging is active.
|
inlineinherited |
Report a debug message.
[in] | msg | Message text. |
|
inlineinherited |
Report a debug message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a debug message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Check if verbose reporting is active.
|
inlineinherited |
Report a verbose message.
[in] | msg | Message text. |
|
inlineinherited |
Report a verbose message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a verbose message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
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.
[in] | severity | Message severity. |
[in] | msg | Message text. |
|
virtualinherited |
Report a message with an explicit severity and a printf-like interface.
[in] | severity | Message severity. |
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
virtualinherited |
Report a message with an explicit severity and a printf-like interface.
[in] | severity | Message severity. |
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a fatal error message.
[in] | msg | Message text. |
|
inlineinherited |
Report a fatal error message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a fatal error message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a severe error message.
[in] | msg | Message text. |
|
inlineinherited |
Report a severe error message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a severe error message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report an error message.
[in] | msg | Message text. |
|
inlineinherited |
Report an error message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report an error message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a warning message.
[in] | msg | Message text. |
|
inlineinherited |
Report a warning message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a warning message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report an informational message.
[in] | msg | Message text. |
Report an informational message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report an informational message with a printf-like interface.
[in] | fmt | Format string with embedded '%' sequences. |
[in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Check if errors (or worse) were reported through this object.
|
inlineinherited |
Reset the error indicator.