ADTF  3.14.3
log.h File Reference

Public API for Logger type, functions and macros. More...

Go to the source code of this file.

Classes

struct  LogEntry
 A log entry. More...
 

Namespaces

 a_util
 Serves as the root component, with common functionality documented in core functionality.
 
 a_util::logging
 Serves as component for basic logging functionality.
 

Macros

#define LOG_ADD_ENTRY(__level, ...)
 Add a log entry to the current logger, including current filename and line number. More...
 
#define LOG_DUMP(...)
 Log a message with LogLevel Dump (only in Debug mode)
 
#define LOG_INFO(...)   LOG_ADD_ENTRY(a_util::logging::Info, __VA_ARGS__)
 Log a message with LogLevel Info.
 
#define LOG_WARNING(...)   LOG_ADD_ENTRY(a_util::logging::Warning, __VA_ARGS__)
 Log a message with LogLevel Warning.
 
#define LOG_ERROR(...)   LOG_ADD_ENTRY(a_util::logging::Error, __VA_ARGS__)
 Log a message with LogLevel Error.
 

Typedefs

typedef experimental::UnaryDelegate< void, const LogEntry & > Logger
 Logger interface definition.
 

Enumerations

enum  LogLevel {
  None = 0 , Error = 10 , Warning = 20 , Info = 30 ,
  Dump = 40 , Debug = Dump , All = 0xFF
}
 Usable log levels for LogEntry::log_level. More...
 

Functions

void addEntry (const LogEntry &entry)
 Adds a new log entry to the current logger. More...
 
void addEntry (std::uint8_t log_level, const std::string &message=a_util::strings::empty_string, const std::string &source=a_util::strings::empty_string)
 Adds a new log entry to the current logger. More...
 
void setLogger (Logger log)
 Sets the currently used logger. More...
 
Logger getLogger ()
 Get the currently used logger. More...
 
std::string defaultFormat (const LogEntry &entry)
 Get the default string representation of a log entry. More...
 
void defaultLogger (const LogEntry &entry)
 Default logging method, that writes log messages to stdout. More...
 

Detailed Description

Public API for Logger type, functions and macros.

Definition in file log.h.

Macro Definition Documentation

◆ LOG_ADD_ENTRY

#define LOG_ADD_ENTRY (   __level,
  ... 
)
Value:
a_util::strings::format(__VA_ARGS__), \
__FILE__ "(" A_UTIL_TO_STRING(__LINE__) ")")
#define A_UTIL_TO_STRING(expression)
Converts an expression to its string representation during preprocessing.
Definition: to_string.h:37
void addEntry(const LogEntry &entry)
Adds a new log entry to the current logger.
std::string format(const char *str_format,...)
printf()-like formatting of an input string.

Add a log entry to the current logger, including current filename and line number.

Parameters
[in]__levelThe log level
[in]...Arguments forwarded to printf()-like formatting

Definition at line 106 of file log.h.


Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Thu Jun 9 2022 by doxygen 1.9.1)