libcamera: libcamera::Loggable Class Reference

libcamera v0.7.2 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
libcamera::Loggable Class Referenceabstract

Base class to support log message extensions. More...

Inheritance diagram for libcamera::Loggable:
[legend]

## Protected Member Functions
virtual std::string | logPrefix () const =0
| Retrieve a string to be prefixed to the log message.
LogMessage | _log (const LogCategory &category, LogSeverity severity, const char *fileName=__builtin_FILE(), unsigned int line=__builtin_LINE()) const
| Create a temporary LogMessage object to log a message.

## Detailed Description

Base class to support log message extensions.

The Loggable class allows classes to extend log messages without any change to the way the LOG() macro is invoked. By inheriting from Loggable and implementing the logPrefix() virtual function, a class can specify extra information to be automatically added to messages logged from class member function.

## Member Function Documentation

## ◆ _log()

LogMessage libcamera::Loggable::_log | ( | const LogCategory & | category,
|  | LogSeverity | severity,
|  | const char * | fileName = __builtin_FILE(),
|  | unsigned int | line = __builtin_LINE() ) const
| protected

Create a temporary LogMessage object to log a message.

Parameters

  [in] | category | The log message category
  [in] | severity | The log message severity
  [in] | fileName | The file name where the message is logged from
  [in] | line | The line number where the message is logged from

This function is used as a backend by the LOG() macro to create a log message for locations inheriting from the Loggable class.

Returns
  A log message

## ◆ logPrefix()

virtual std::string libcamera::Loggable::logPrefix | ( |  | ) | const
| protectedpure virtual

Retrieve a string to be prefixed to the log message.

This function allows classes inheriting from the Loggable class to extend the logger with an object-specific prefix output right before the log message contents.

Returns
  A string to be prefixed to the log message

Implemented in libcamera::CameraLens, libcamera::ipa::ipu3::IPAIPU3, libcamera::IPAModule, libcamera::MediaDevice, libcamera::V4L2Subdevice, and libcamera::V4L2VideoDevice.

The documentation for this class was generated from the following files:

- include/libcamera/base/log.h
- src/libcamera/base/log.cpp