Creates a Logger providing the means to send log messages.

Syntax

// Variant 1
auto amsr::log::CreateLogger(core::StringView ctx_id, core::StringView ctx_description) -> Logger & [noexcept]

notice

Note for Variant 1: The returned logger will become invalid during calls to core::Deinitialize.

// Variant 2
auto ara::log::CreateLogger(core::StringView ctx_id, core::StringView ctx_description) -> Logger & [noexcept]

Parameters

ctx_id

Context ID

ctx_description

Context description

Returns

Logger & Reference to logger

Precondition

Additional Information

Example

// Example for Variant 2
ara::log::Logger& PPortExampleServiceProvider::GetLogger() {
  static ara::log::Logger& logger{ara::log::CreateLogger(ara::core::StringView("MyContextID"),
                                                         ara::core::StringView("Context for example service provider"))};
  return logger;
}