Assumptions of Use#
Log Assumptions of Use
|
status: valid
security: NO
safety: ASIL_B
|
||||
Undocumented or Private APIs
|
status: valid
security: NO
safety: ASIL_B
|
||||
Undocumented or private API from The public API of In the following example, the namespace mw::log
{
namespace details
{
class TextRecorder : public Recorder // Private undocumented API SHALL NOT be used.
{
// ...
};
} // namespace detail
/*
* \public
*/
LogStream LogInfo(); // Public API is OK to be used by Safety-Related Application Software.
} // namespace mw::log
|
|||||
Unsupported Contexts
|
status: valid
security: NO
safety: ASIL_B
|
||||
The log frontend API shall not be used from unsupported contexts.
The majority of the mw::log API is thread-safe. Thread-safe API can be recognized by the thread-safe tag in the documentation: class Logger
{
/// \brief Creates a LogStream to log messages of criticality `Fatal` (highest).
///
/// \public
/// \thread-safe
///
/// \details Fatal shall be used on errors that cannot be recovered and will lead to an overall failure in the
/// system. The message will be logged under the context that was provided on construction.
///
/// \return LogStream which can be used stream verbose logging messages (will be flushed on destruction)
log::LogStream LogFatal() const noexcept;
};
auto log_stream = logger.LogInfo();
std::thread t1([&](){
// Do not access log_stream from another thread!
log_stream << "test";
});
log_stream << "hello";
|
|||||
Logging During the C++ Static Storage
construction and destruction.
|
status: valid
security: NO
safety: ASIL_B
|
||||
struct MyClass {
MyClass() {
mw::log::LogInfo() << "MyClass()"; // mw::log SHALL NOT be used before entering main().
}
~MyClass() {
mw::log::LogInfo() << "MyClass()"; // mw::log SHALL NOT be used after exiting main().
}
};
static MyClass singleton{};
|
|||||
Console Logging
|
status: valid
security: NO
safety: ASIL_B
|
||||
Console logging shall not be used in production. |
|||||
Applications relying on logs
verification/qualification/case.
|
status: valid
security: NO
safety: ASIL_B
|
||||
Applications shall not rely on mw::log output for safety verification/qualification/case. Safety-Related Platform Software and Safety-Related Application Software shall not rely on the presence of any form of mw::log output for delivering their business logic. This shall hold even for logs sent out by the application itself. Safety-Related Platform Software and Safety-Related Application Software behavior shall not depend on log messages: void Step() {
// Do not rely on log messages!
if ( ReceiveStopLogMessage() ) {
ExecuteStopCommand();
}
// ...
This requirement shall be verified for each assigned application. The whole dependency tree of all included libraries shall be also verified on this requirement in the application use case and by application developers. |
|||||