본문으로 건너뛰기

ara::log

개요

Log & Trace Functional Cluster는 Adaptive Application을 위한 DLT 기반 로깅/트레이싱을 제공합니다. 이 페이지는 ara::log 네임스페이스의 공개 API 명세로, 로거 컨텍스트 · 로그 스트림 · 심각도 수준 · 포매팅 도우미를 헤더 파일 단위로 정리합니다. API 명세 본문은 영어 원문으로 제공됩니다.

라이브러리 · 헤더 · 링크

  • 라이브러리: lib/libpara_log.so
  • CMake: find_package(para-log)para::log
  • 표준 헤더: include/ara/log/ (logger.h, log_stream.h, common.h)
  • PARA 확장 헤더: include/para/log/vendor.h, include/apext/log/trace_arti.h
  • 백엔드: DLT (external/bin/dlt-daemon, etc/dlt/dlt.conf)

1 Header: ara/log/common.h

1.1 Non-Member Types

1.1.1 Enumeration: ClientState

Kind:enumeration
Header file:#include "ara/log/common.h"
Forwarding header file:#include "ara/log/log_fwd.h"
Scope:namespace ara::log
Symbol:ClientState
Underlying type:std::int8_t
Syntax:enum class ClientState : std::int8_t {...};
Values:kUnknown= -1
DLT back-end not up and running yet, state cannot be determined.
kNotConnectedNo remote client detected.
kConnectedRemote client is connected.
Description:Client state representing the connection state of an external client. .

1.1.2 Enumeration: LogLevel

Kind:enumeration
Header file:#include "ara/log/common.h"
Forwarding header file:#include "ara/log/log_fwd.h"
Scope:namespace ara::log
Symbol:LogLevel
Underlying type:std::uint8_t
Syntax:enum class LogLevel : std::uint8_t {...};
Values:kOff= 0x00
No logging.
kFatal= 0x01
Fatal error, not recoverable.
kError= 0x02
Error with impact to correct functionality.
kWarn= 0x03
Warning if correct behavior cannot be ensured.
kInfo= 0x04
Informational, providing high level understanding.
kDebug= 0x05
Detailed information for programmers.
kVerbose= 0x06
Extra-verbose debug messages (highest grade of information)
Description:List of possible severity levels .

2 Header: ara/log/log_stream.h

2.1 Non-Member Functions

2.1.1 Other

2.1.1.1 operator<<(LogStream&, const std::chrono::duration<Rep, Period>&)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:namespace ara::log
Syntax:template <typename Rep, typename Period>
ara::log::LogStream & operator<< (ara::log::LogStream &out, const std::chrono::duration< Rep, Period > &value) noexcept;
Template param:Reparithmetic type representing the number of ticks in this duration
Perioda std::ratio type representing the tick period of the clock, in seconds
Parameters (in):valuethe duration instance to log
Parameters (inout):outthe LogStream object into which to add the value
Return value:LogStream &out
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Write a std::chrono::duration instance into the message.
2.1.1.2 operator<<(LogStream&, const ara::core::InstanceSpecifier&)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:namespace ara::log
Syntax:ara::log::LogStream & operator<< (ara::log::LogStream &out, const ara::core::InstanceSpecifier &value) noexcept;
Parameters (in):valuethe InstanceSpecifier to log
Parameters (inout):outthe LogStream object into which to add the value
Return value:LogStream &out
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Write a core::InstanceSpecifier into the message.
2.1.1.3 operator<<(LogStream&, const void *)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:namespace ara::log
Syntax:ara::log::LogStream & operator<< (ara::log::LogStream &out, const void *value) noexcept;
Parameters (in):valueto log
Parameters (inout):outthe LogStream object into which to add the value
Return value:LogStream &out
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Write a raw pointer into the message.
2.1.1.4 operator<<(LogStream&, LogLevel)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:namespace ara::log
Syntax:ara::log::LogStream & operator<< (ara::log::LogStream &out, ara::log::LogLevel value) noexcept;
Parameters (in):valueLogLevel enum parameter as text to be appended to the internal message buffer.
Parameters (inout):outLogStream Object which is used to append the logged LogLevel (value) to
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Appends LogLevel enum parameter as text into message.
2.1.1.5 operator<<(LogStream&, const core::ErrorCode&)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:namespace ara::log
Syntax:ara::log::LogStream & operator<< (ara::log::LogStream &out, const core::ErrorCode &ec) noexcept;
Parameters (in):ecthe ErrorCode instance to log
Parameters (inout):outthe LogStream object into which to add the value
Return value:LogStream &out
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Write a core::ErrorCode instance into the message. When output to the console, the ErrorCode shall be shown in an implementation-defined way as a String holding the result of ErrorCode:Domain().Name() (i.e. the ErrorDomain's Shortname), and the integral error code number.

2.2 Class: Argument

Kind:class
Header file:#include "ara/log/log_stream.h"
Forwarding header file:#include "ara/log/log_fwd.h"
Scope:namespace ara::log
Symbol:Argument
Syntax:template <typename T>
class Argument final {...};
Template param:typename Tthe argument payload type
Description:Wrapper type for holding a payload argument with its attributes. The setup of this class is implementation-defined.

2.3 Class: LogStream

Kind:class
Header file:#include "ara/log/log_stream.h"
Forwarding header file:#include "ara/log/log_fwd.h"
Scope:namespace ara::log
Symbol:LogStream
Syntax:class LogStream final {...};
Description:Represents a Log message, allowing stream operators to be used for appending data. Note:
Normally Application processes would not use this class directly. Instead one of the log methods provided in the main Logging API shall be used. Those methods automatically setup a temporary object of this class with the given log severity level. The only reason to use this class directly is, if the user wants to hold a ara::log::LogStream object longer than the default one-statement scope. This is useful in order to create log messages that are distributed over multiple code lines. See the ara::log::LogStream::Flush() method for further information. Once this temporary object gets out of scope, its destructor takes care that the message buffer is ready to be processed by the Logging framework. Besides the existing supported operator<< overloads for ara::log::LogStream it can be easily extended for other derived types by providing a stream operator that makes use of already supported types.

Example:

struct MyCustomType {
int8_t foo;
ara::core::String bar;
};

LogStream& operator<<(LogStream& out, const MyCustomType& value) {
return (out << value.foo << value.bar);
}

// Producing the output "42 the answer is."
Logger& ctx0 = CreateLogger("CTX0", "Context Description CTX0");
ctx0.LogDebug() << MyCustomType{42, " the answer is."};

2.3.1 Public Member Functions

2.3.1.1 Special Member Functions
2.3.1.1.1 Copy Constructor
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:LogStream (const LogStream &)=delete;
Description:The copy constructor is deleted.
2.3.1.1.2 Move Constructor
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:LogStream (LogStream &&) noexcept;
DIRECTION NOT DEFINEDLogStream &&--
Exception Safety:exception safe
Description:The move constructor is treated in a way that allows returning an instance from a function. Typically, the move constructor is only declared, but not defined. This allows a C++14-compliant compiler to use RVO (Return Value Optimization) to return an instance from a factory-like function.
2.3.1.1.3 Copy Assignment Operator
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator= (const ara::log::LogStream &)=delete;
Description:The copy assignment operator is deleted.
2.3.1.1.4 Move Assignment Operator
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator= (ara::log::LogStream &&)=delete;
Description:The move assignment operator is deleted.
2.3.1.1.5 Destructor
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:~LogStream() noexcept;
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Destructor.
2.3.1.2 Member Functions
2.3.1.2.1 Flush
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:void Flush () noexcept;
Return value:None
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Sends out the current log buffer and initiates a new message stream. Note:
Calling ara::log::LogStream::Flush() is only necessary if the ara::log::LogStream object is going to be re-used within the same scope. Otherwise, if the object goes out of scope (e.g. end of function block) then the flushing operation will be done internally by the destructor. It is important to note that the ara::log::LogStream::Flush() command does not empty the buffer, but it forwards the buffer's current contents to the Logging framework.
2.3.1.2.2 WithLocation
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & WithLocation (core::StringView file, int line) noexcept;
Parameters (in):filethe source file identifier
linethe source file line number
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Add source file location into the message.
2.3.1.2.3 WithPrivacy
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:template <typename T>
ara::log::LogStream & WithPrivacy (T value) noexcept;
Parameters (in):valuea (project-specific) value to add as privacy level of the message template
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Set the message's privacy level. A program that calls this function with a T that is neither an integral nor an enum type is ill-formed. Only the lower 8 bits of value are used, any higher-level bits are ignored.
2.3.1.2.4 WithTag
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & WithTag (core::StringView tag) noexcept;
Parameters (in):tagthe tag text to attach to the current message
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Add the given single tag to the current message.
2.3.1.2.5 operator<<(std::uint8_t)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (std::uint8_t value) noexcept;
Parameters (in):valueValue to be appended to the internal message buffer.
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Writes unsigned int 8 bit parameter into message.
2.3.1.2.6 operator<<(std::uint16_t)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (std::uint16_t value) noexcept;
Parameters (in):valueValue to be appended to the internal message buffer.
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Writes unsigned int 16 bit parameter into message.
2.3.1.2.7 operator<<(std::uint32_t)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (std::uint32_t value) noexcept;
Parameters (in):valueValue to be appended to the internal message buffer.
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Writes unsigned int 32 bit parameter into message.
2.3.1.2.8 operator<<(std::uint64_t)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (std::uint64_t value) noexcept;
Parameters (in):valueValue to be appended to the internal message buffer.
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Writes unsigned int 64 bit parameter into message.
2.3.1.2.9 operator<<(std::int8_t)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (std::int8_t value) noexcept;
Parameters (in):valueValue to be appended to the internal message buffer.
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Writes signed int 8 bit parameter into message.
2.3.1.2.10 operator<<(bool)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (bool value) noexcept;
Parameters (in):valueValue to be appended to the internal message buffer.
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Appends given value to the internal message buffer.
2.3.1.2.11 operator<<(std::int64_t)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (std::int64_t value) noexcept;
Parameters (in):valueValue to be appended to the internal message buffer.
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Writes signed int 64 bit parameter into message.
2.3.1.2.12 operator<<(std::int32_t)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (std::int32_t value) noexcept;
Parameters (in):valueValue to be appended to the internal message buffer.
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Writes signed int 32 bit parameter into message.
2.3.1.2.13 operator<<(std::int16_t)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (std::int16_t value) noexcept;
Parameters (in):valueValue to be appended to the internal message buffer.
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Writes signed int 16 bit parameter into message.
2.3.1.2.14 operator<<(float)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (float value) noexcept;
Parameters (in):valueValue to be appended to the internal message buffer.
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Writes float 32 bit parameter into message.
2.3.1.2.15 operator<<(double)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (double value) noexcept;
Parameters (in):valueValue to be appended to the internal message buffer.
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Writes float 64 bit parameter into message.
2.3.1.2.16 operator<<(const ara::core::StringView)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (const ara::core::StringView value) noexcept;
Parameters (in):valueValue to be appended to the internal message buffer.
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Writes ara::core::StringView into message.
2.3.1.2.17 operator<<(const char *const)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (const char *const value) noexcept;
Parameters (in):valueValue to be appended to the internal message buffer.
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Writes null terminated UTF8 string into message.
2.3.1.2.18 operator<<(core::Span<const core::Byte>)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:ara::log::LogStream & operator<< (core::Span< const core::Byte > data) noexcept;
Parameters (in):dataa Span<const Byte> covering the range to be logged
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Write a byte sequence into message. This call shall copy the sequence of core::Byte objects as-is into the message.
2.3.1.2.19 operator<<(const Argument<T>&)
Kind:function
Header file:#include "ara/log/log_stream.h"
Scope:ara::log::LogStream
Syntax:template <typename T>
ara::log::LogStream & operator<< (const ara::log::Argument< T > &arg) noexcept;
Template param:Tthe argument payload type
Parameters (in):argthe argument wrapper object
Return value:LogStream &*this
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Log an argument with attributes. When output to the console, the value and all its attributes shall be shown as a single argument.

3 Header: ara/log/logger.h

3.1 Non-Member Types

3.1.1 Type Alias: ConnectionStateHandler

Kind:type alias
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Symbol:ConnectionStateHandler
Syntax:using ConnectionStateHandler = std::function<void(ClientState)>;
Thread Safety:thread-safe
Description:Callback function type to be registered in ara::log::RegisterConnectionStateHandler().

3.1.2 Enumeration: Fmt

Kind:enumeration
Header file:#include "ara/log/logger.h"
Forwarding header file:#include "ara/log/log_fwd.h"
Scope:namespace ara::log
Symbol:Fmt
Underlying type:std::uint16_t
Syntax:enum class Fmt : std::uint16_t {...};
Values:kDefault= 0
implementation-defined formatting
kDec= 1
decimal (signed/unsigned)
kOct= 2
octal
kHex= 3
hexadecimal
kBin= 4
binary
kDecFloat= 5
decimal float (like printf "%f")
kEngFloat= 6
engineering float (like printf "%e")
kHexFloat= 7
hex float (like printf "%a")
kAutoFloat= 8
automatic "shortest" float (like printf "%g")
Description:Format specifiers for log message arguments .

3.2 Non-Member Functions

3.2.1 Other

3.2.1.1 Arg
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:template <typename T>
ara::log::Argument< T > Arg (T &&arg, const char *name=nullptr, const char *unit=nullptr, ara::log::Format format=Dflt()) noexcept;
Template param:Tthe type of arg
Parameters (in):argan argument payload object
namean optional "name" attribute for arg
unitan optional "unit" attribute for arg
formatan optional formatting hint for integral or floating-point arguments; the default is to use the implementation's standard formatting
Return value:Argument< T >a wrapper object holding the supplied arguments
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a wrapper object for the given arguments. Calling this function shall be ill-formed if any of these conditions are met:
• T is not an arithmetic type and not "bool" and not convertible to "ara::core::StringView" and not convertible to "ara::core::Span<const ara::core::Byte>"
• T is convertible to "ara::core::StringView" or convertible to "ara::core::Span<const ara::core::Byte>" or "bool", and "unit" is not "nullptr"
3.2.1.2 AutoFloat
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format AutoFloat (std::uint16_t precision=6) noexcept;
Parameters (in):precisionthe precision to use
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kAutoFloat formatting hint and given precision.
3.2.1.3 AutoFloatMax
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format AutoFloatMax () noexcept;
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kAutoFloat formatting hint and a precision that is sufficient for full round-trip safety. .
3.2.1.4 Bin()
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format Bin () noexcept;
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kBin formatting hint and default precision. .
3.2.1.5 Bin(std::uint16_t)
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format Bin (std::uint16_t precision) noexcept;
Parameters (in):precisionthe precision to use
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kBin formatting hint and given precision.
3.2.1.6 CreateLogger(const ara::core::InstanceSpecifier&)
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:ara::log::Logger & CreateLogger (const ara::core::InstanceSpecifier &is) noexcept;
Parameters (in):isan InstanceSpecifier
Return value:Logger &reference to the internal managed instance of a Logger object
Exception Safety:exception safe
Thread Safety:thread-safe
Violations:InstanceSpecifierMappingIntegrityViolationInstanceSpecifier either cannot be resolved in the model in the context of your executable, or it refers to a model element other than a PortPrototype.
PortInterfaceMappingViolationThe type of mapping does not match the expected type of PortInterface.
ProcessMappingViolationMatching InstanceRef exists, but no matching (modelled) Process found that matches the (runtime) process.
InstanceSpecifierAlreadyInUseViolationViolation message that is sent in case a constructor in the ara framework was called with an InstanceSpecifier already in use in this process.
Description:Creates a Logger object derived from the manifest.
3.2.1.7 CreateLogger(ara::core::StringView, ara::core::StringView)
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:ara::log::Logger & CreateLogger (ara::core::StringView ctxId, ara::core::StringView ctxDescription) noexcept;
Parameters (in):ctxIdThe context ID
ctxDescriptionThe description of the provided context ID
Return value:Logger &reference to the internal managed instance of a Logger object Ownership stays within the Logging framework
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Creates a Logger object, holding the context which is registered in the Logging framework. If no model is available the sink shall be the console per default.
3.2.1.8 CreateLogger(ara::core::StringView, ara::core::StringView, LogLevel)
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:ara::log::Logger & CreateLogger (ara::core::StringView ctxId, ara::core::StringView ctxDescription, ara::log::LogLevel ctxDefLogLevel) noexcept;
Parameters (in):ctxIdThe context ID.
ctxDescriptionThe description of the provided context ID.
ctxDefLogLevelThe default log level, set to Warning severity if not explicitly specified.
Return value:Logger &Reference to the internal managed instance of a Logger object. Ownership stays within the Logging framework
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Creates a Logger object, holding the context which is registered in the Logging framework. If no model is available the sink shall be the console per default.
3.2.1.9 Dec(std::uint16_t)
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format Dec (std::uint16_t precision) noexcept;
Parameters (in):precisionthe precision to use
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kDec formatting hint and given precision.
3.2.1.10 Dec()
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format Dec () noexcept;
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kDec formatting hint and default precision. .
3.2.1.11 DecFloat
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format DecFloat (std::uint16_t precision=6) noexcept;
Parameters (in):precisionthe precision to use
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kDecFloat formatting hint and given precision.
3.2.1.12 DecFloatMax
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format DecFloatMax () noexcept;
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kDecFloat formatting hint and a precision that is sufficient for full round-trip safety. .
3.2.1.13 Dflt
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format Dflt () noexcept;
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kDefault formatting hint. .
3.2.1.14 EngFloat
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format EngFloat (std::uint16_t precision=6) noexcept;
Parameters (in):precisionthe precision to use
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kEngFloat formatting hint and given precision.
3.2.1.15 EngFloatMax
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format EngFloatMax () noexcept;
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kEngFloat formatting hint and a precision that is sufficient for full round-trip safety. .
3.2.1.16 Hex()
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format Hex () noexcept;
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kHex formatting hint and default precision. .
3.2.1.17 Hex(std::uint16_t)
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format Hex (std::uint16_t precision) noexcept;
Parameters (in):precisionthe precision to use
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kHex formatting hint and given precision.
3.2.1.18 HexFloat
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format HexFloat (std::uint16_t precision) noexcept;
Parameters (in):precisionthe precision to use
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kHexFloat formatting hint and given precision.
3.2.1.19 HexFloatMax
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format HexFloatMax () noexcept;
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kHexFloat formatting hint and a precision that is sufficient for full round-trip safety. .
3.2.1.20 Oct(std::uint16_t)
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format Oct (std::uint16_t precision) noexcept;
Parameters (in):precisionthe precision to use
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kOct formatting hint and given precision.
3.2.1.21 Oct()
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:constexpr ara::log::Format Oct () noexcept;
Return value:Formata Format instance
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Create a Format instance with Fmt::kOct formatting hint and default precision. .
3.2.1.22 RegisterConnectionStateHandler
Kind:function
Header file:#include "ara/log/logger.h"
Scope:namespace ara::log
Syntax:void RegisterConnectionStateHandler (ara::log::ConnectionStateHandler callback) noexcept;
Parameters (in):callbacka callback that is invoked whenever the connection state has changed
Return value:None
Exception Safety:exception safe
Thread Safety:not thread-safe
Description:Register a callback to be invoked whenever the connection state changes. Only a single function can be installed this way; if a callback was already registered before, only the newly registered one is used henceforth.

3.3 Struct: Format

Kind:struct
Header file:#include "ara/log/logger.h"
Forwarding header file:#include "ara/log/log_fwd.h"
Scope:namespace ara::log
Symbol:Format
Syntax:struct Format final {...};
Description:A type holding a formatting hint. The interpretation of precision depends on fmt: For integral types (i.e. Fmt::kDec, Fmt::kOct, Fmt::kHex, Fmt::kBin), precision is interpreted as the minimum number of digits to output, similar to e.g. std::printf("%.7d"). For the floating-point specifiers Fmt::kDecFloat, Fmt::kEngFloat and Fmt::kHexFloat, precision denotes the exact number of digits to be shown after the decimal point; for Fmt::kAutoFloat, precision denotes the number of significant digits to be shown according to the rules of the std::printf "%g" specifier. If fmt is Fmt::kDefault, the precision field is ignored, and an implementation-defined formatting is applied. For integral types, if precision is 0, it is interpreted the same as if it was 1.

3.3.1 Public Member Variables

3.3.1.1 fmt
Kind:variable
Header file:#include "ara/log/logger.h"
Scope:ara::log::Format
Symbol:fmt
Type:Fmt
Syntax:Fmt fmt;
Description:the format specifier
3.3.1.2 precision
Kind:variable
Header file:#include "ara/log/logger.h"
Scope:ara::log::Format
Symbol:precision
Type:std::uint16_t
Syntax:std::uint16_t precision;
Description:the precision to use

3.4 Class: Logger

Kind:class
Port Interfaces:LogAndTraceInterface
Header file:#include "ara/log/logger.h"
Forwarding header file:#include "ara/log/log_fwd.h"
Scope:namespace ara::log
Symbol:Logger
Syntax:class Logger final {...};
Description:Represents a logger context. The Logging framework defines contexts which can be seen as logger instances within one Application process or process scope. The contexts have the following properties:
• Context ID
• Description of the Context ID
• Default log level

A context will be automatically registered against the Logging backend during creation phase, as well as automatically deregistered during process shutdown phase. So the end user does not care for the objects life time. To ensure such housekeeping functionality, a strong ownership of the logger instances needs to be ensured towards the Logging framework. This means that the Application process are not supposed to call the Logger constructor themselves. The user is not allowed to create a Logger object by himself. Logger context needs to be created by one of the ara::log::CreateLogger functions.

3.4.1 Public Member Functions

3.4.1.1 Special Member Functions
3.4.1.1.1 Default Constructor
Kind:function
Header file:#include "ara/log/logger.h"
Scope:ara::log::Logger
Syntax:Logger ()=delete;
Description:Default destructor is deleted.
3.4.1.1.2 Destructor
Kind:function
Header file:#include "ara/log/logger.h"
Scope:ara::log::Logger
Syntax:~Logger();
Exception Safety:not exception safe
Thread Safety:thread-safe
Description:Destructor .
3.4.1.2 Member Functions
3.4.1.2.1 IsEnabled
Kind:function
Header file:#include "ara/log/logger.h"
Scope:ara::log::Logger
Syntax:bool IsEnabled (ara::log::LogLevel logLevel) const noexcept;
Parameters (in):logLevelThe to be checked log level.
Return value:boolTrue if desired log level satisfies the configured reporting level.
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Check current configured log reporting level. Applications may want to check the actual configured reporting log level of certain loggers before doing log data preparation that is runtime intensive.
3.4.1.2.2 Log
Kind:function
Header file:#include "ara/log/logger.h"
Scope:ara::log::Logger
Syntax:template <typename MsgId, typename... Params>
void Log (const MsgId &id, const Params &... args) noexcept;
Template param:MsgIdthe type of the id parameter
Argsthe types of the args parameters
Parameters (in):idan implementation-defined type identifying the message object
argsthe arguments to add to the message
Return value:None
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Log a modeled message. If this function is called with an argument list that does not match the modeled message, the program is ill-formed.
3.4.1.2.3 LogDebug
Kind:function
Header file:#include "ara/log/logger.h"
Scope:ara::log::Logger
Syntax:ara::log::LogStream LogDebug () const noexcept;
Return value:LogStreamLogStream object of Debug severity.
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Same as Logger::LogFatal(). .
3.4.1.2.4 LogError
Kind:function
Header file:#include "ara/log/logger.h"
Scope:ara::log::Logger
Syntax:ara::log::LogStream LogError () const noexcept;
Return value:LogStreamLogStream object of Error severity.
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Same as Logger::LogFatal(). .
3.4.1.2.5 LogFatal
Kind:function
Header file:#include "ara/log/logger.h"
Scope:ara::log::Logger
Syntax:ara::log::LogStream LogFatal () const noexcept;
Return value:LogStreamLogStream object of Fatal severity.
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Creates a LogStream object. Returned object will accept arguments via the insert stream operator "@c <{}<".
Notes:In the normal usage scenario, the object's life time of the created LogStream is scoped within one statement (ends with ; after last passed argument). If one wants to extend the LogStream object's life time, the object might be assigned to a named variable. Refer to the LogStream class documentation for further details.
3.4.1.2.6 LogInfo
Kind:function
Header file:#include "ara/log/logger.h"
Scope:ara::log::Logger
Syntax:ara::log::LogStream LogInfo () const noexcept;
Return value:LogStreamLogStream object of Info severity.
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Same as Logger::LogFatal(). .
3.4.1.2.7 LogVerbose
Kind:function
Header file:#include "ara/log/logger.h"
Scope:ara::log::Logger
Syntax:ara::log::LogStream LogVerbose () const noexcept;
Return value:LogStreamLogStream object of Verbose severity.
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Same as Logger::LogFatal(). .
3.4.1.2.8 LogWarn
Kind:function
Header file:#include "ara/log/logger.h"
Scope:ara::log::Logger
Syntax:ara::log::LogStream LogWarn () const noexcept;
Return value:LogStreamLogStream object of Warn severity.
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Same as Logger::LogFatal(). .
3.4.1.2.9 LogWith
Kind:function
Header file:#include "ara/log/logger.h"
Scope:ara::log::Logger
Syntax:template <typename... Attrs, typename MsgId, typename... Params>
void LogWith (const std::tuple< Attrs... > &attrs, const MsgId &msgId, const Params &... params) noexcept;
Template param:Attrsthe types of attrs
MsgIdthe type of msgId
Paramsthe types of the params
Parameters (in):attrsa std::tuple containing attributes of the message
msgIdan implementation-defined instance of type MsgId identifying the message object
paramsthe arguments to add to the message
Return value:None
Exception Safety:exception safe
Thread Safety:thread-safe
Description:This function does not participate in overload resolution if any of Attrs... is not an "Attr" (TBD).
3.4.1.2.10 SetThreshold
Kind:function
Header file:#include "ara/log/logger.h"
Scope:ara::log::Logger
Syntax:void SetThreshold (ara::log::LogLevel threshold) noexcept;
Parameters (in):thresholdthe new threshold
Return value:None
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Set log level threshold for this Logger instance.
3.4.1.2.11 WithLevel
Kind:function
Header file:#include "ara/log/logger.h"
Scope:ara::log::Logger
Syntax:ara::log::LogStream WithLevel (ara::log::LogLevel logLevel) const noexcept;
Parameters (in):logLevelthe log level to use for this LogStream instance
Return value:LogStreama new LogStream instance with the given log level
Exception Safety:exception safe
Thread Safety:thread-safe
Description:Log message with a programmatically determined log level can be written.

참고