libcamera: libcamera::Logger Class Reference

libcamera v0.5.1 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
libcamera::Logger Class Reference

Message logger. More...

## Public Member Functions
void | write (const LogMessage &msg)
| Write a message to the configured logger output.
void | backtrace ()
| Write a backtrace to the log.
int | logSetFile (const char *path, bool color)
| Set the log file.
int | logSetStream (std::ostream *stream, bool color)
| Set the log stream.
int | logSetTarget (LoggingTarget target)
| Set the log target.
void | logSetLevel (const char *category, const char *level)
| Set the log level.

## Static Public Member Functions
static Logger * | instance ()
| Retrieve the logger instance.

## Detailed Description

Message logger.

The Logger class handles log configuration.

## Member Function Documentation

## ◆ instance()

Logger * libcamera::Logger::instance | ( |  | ) |
| static

Retrieve the logger instance.

The Logger is a singleton and can't be constructed manually. This function shall instead be used to retrieve the single global instance of the logger.

Returns
  The logger instance

## ◆ logSetFile()

int libcamera::Logger::logSetFile | ( | const char * | path,
|  | bool | color )

Set the log file.

Parameters

  [in] | path | Full path to the log file
  [in] | color | True to output colored messages

See also
  libcamera::logSetFile()

Returns
  Zero on success, or a negative error code otherwise.

## ◆ logSetLevel()

void libcamera::Logger::logSetLevel | ( | const char * | category,
|  | const char * | level )

Set the log level.

Parameters

  [in] | category | Logging category
  [in] | level | Log level

See also
  libcamera::logSetLevel()

## ◆ logSetStream()

int libcamera::Logger::logSetStream | ( | std::ostream * | stream,
|  | bool | color )

Set the log stream.

Parameters

  [in] | stream | Stream to send log output to
  [in] | color | True to output colored messages

See also
  libcamera::logSetStream()

Returns
  Zero on success, or a negative error code otherwise.

## ◆ logSetTarget()

int libcamera::Logger::logSetTarget | ( | LoggingTarget | target | ) |

Set the log target.

Parameters

  [in] | target | Log destination

See also
  libcamera::logSetTarget()

Returns
  Zero on success, or a negative error code otherwise.

## ◆ write()

void libcamera::Logger::write | ( | const LogMessage & | msg | ) |

Write a message to the configured logger output.

Parameters

  [in] | msg | The message object

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

- src/libcamera/base/log.cpp