libcamera  v0.2.0+150-2031e2f2
Supporting cameras in Linux since 2019
Public Member Functions | Static Public Member Functions | List of all members
libcamera::Logger Class Reference

Message logger. More...

Public Member Functions

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

Static Public Member Functions

static Loggerinstance ()
 Retrieve the logger instance. More...
 

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]pathFull path to the log file
[in]colorTrue 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]categoryLogging category
[in]levelLog level
See also
libcamera::logSetLevel()

◆ logSetStream()

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

Set the log stream.

Parameters
[in]streamStream to send log output to
[in]colorTrue 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]targetLog 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]msgThe message object

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