Compute Library
 21.05
arm_compute::logging Namespace Reference

Data Structures

class  DateDecorator
 Date Decorator. More...
 
class  FilePrinter
 File Printer. More...
 
class  IDecorator
 Log message decorator interface. More...
 
class  Logger
 Logger class. More...
 
class  LoggerRegistry
 Registry class holding all the instantiated loggers. More...
 
class  LogLevelDecorator
 Log Level Decorator. More...
 
struct  LogMsg
 Log message. More...
 
class  Printer
 Base printer class to be inherited by other printer classes. More...
 
class  StdPrinter
 Std Printer. More...
 
class  StringDecorator
 String Decorator. More...
 
class  ThreadIdDecorator
 Thread ID Decorator. More...
 

Enumerations

enum  LogLevel {
  VERBOSE, INFO, WARN, ERROR,
  OFF
}
 Logging level enumeration. More...
 

Functions

template<typename... Ts>
std::string string_with_format (const std::string &fmt, Ts &&... args)
 Create a string given a format. More...
 
template<typename T >
std::string angle_wrap_value (const T &val)
 Wraps a value with angles and returns the string. More...
 
const std::string & string_from_log_level (LogLevel log_level)
 Translates a given log level to a string. More...
 

Enumeration Type Documentation

◆ LogLevel

enum LogLevel
strong

Logging level enumeration.

Enumerator
VERBOSE 

All logging messages.

INFO 

Information log level.

WARN 

Warning log level.

ERROR 

Error log level.

OFF 

No logging.

Definition at line 34 of file Types.h.

35 {
36  VERBOSE, /**< All logging messages */
37  INFO, /**< Information log level */
38  WARN, /**< Warning log level */
39  ERROR, /**< Error log level */
40  OFF /**< No logging */
41 };

Function Documentation

◆ angle_wrap_value()

std::string arm_compute::logging::angle_wrap_value ( const T &  val)
inline

Wraps a value with angles and returns the string.

Parameters
[in]valValue to wrap
Returns
Wrapped string

Definition at line 62 of file Helpers.h.

63 {
64  std::ostringstream ss;
65  ss << "[" << val << "]";
66  return ss.str();
67 }
std::stringstream ss(mlgo_str)

References arm_compute::test::validation::ss().

Referenced by DateDecorator::decorate(), ThreadIdDecorator::decorate(), LogLevelDecorator::decorate(), and StringDecorator::StringDecorator().

◆ string_from_log_level()

const std::string & string_from_log_level ( LogLevel  log_level)

Translates a given log level to a string.

Parameters
[in]log_levelLogLevel to be translated to string.
Returns
The string describing the logging level.

Definition at line 31 of file Helpers.cpp.

32 {
33  static std::map<LogLevel, const std::string> log_level_map =
34  {
35  { LogLevel::VERBOSE, "VERBOSE" },
36  { LogLevel::INFO, "INFO" },
37  { LogLevel::WARN, "WARN" },
38  { LogLevel::OFF, "OFF" },
39  };
40 
41  return log_level_map[log_level];
42 }

References INFO, OFF, VERBOSE, and WARN.

Referenced by LogLevelDecorator::decorate().

◆ string_with_format()

std::string arm_compute::logging::string_with_format ( const std::string &  fmt,
Ts &&...  args 
)
inline

Create a string given a format.

Parameters
[in]fmtString format
[in]argsArguments
Returns
The formatted string

Definition at line 48 of file Helpers.h.

49 {
50  size_t size = support::cpp11::snprintf(nullptr, 0, fmt.c_str(), args...) + 1;
51  auto char_str = std::make_unique<char[]>(size);
52  support::cpp11::snprintf(char_str.get(), size, fmt.c_str(), args...);
53  return std::string(char_str.get(), char_str.get() + size - 1);
54 }
int snprintf(char *s, std::size_t n, const char *fmt, Ts &&... args)
Loads the data from the given location, converts them to character string equivalents and writes the ...

References GemmTuner::args, and arm_compute::support::cpp11::snprintf().

Referenced by Logger::log().