libcamera  v0.0.0
Supporting cameras in Linux since 2019
Enumerations | Functions
logging.h File Reference

Logging management. More...

Go to the source code of this file.

Enumerations

enum  libcamera::LoggingTarget { libcamera::LoggingTargetNone , libcamera::LoggingTargetSyslog , libcamera::LoggingTargetFile , libcamera::LoggingTargetStream }
 Log destination type. More...
 

Functions

int libcamera::logSetFile (const char *path)
 Direct logging to a file. More...
 
int libcamera::logSetStream (std::ostream *stream)
 Direct logging to a stream. More...
 
int libcamera::logSetTarget (LoggingTarget target)
 Set the logging target. More...
 
void libcamera::logSetLevel (const char *category, const char *level)
 Set the log level. More...
 

Detailed Description

Logging management.

API to change the logging output destination and log levels programatically.

Enumeration Type Documentation

◆ LoggingTarget

Log destination type.

Enumerator
LoggingTargetNone 

No logging destination.

See also
Logger::logSetTarget
LoggingTargetSyslog 

Log to syslog.

See also
Logger::logSetTarget
LoggingTargetFile 

Log to file.

See also
Logger::logSetFile
LoggingTargetStream 

Log to stream.

See also
Logger::logSetStream

Function Documentation

◆ logSetFile()

int libcamera::logSetFile ( const char *  path)

Direct logging to a file.

Parameters
[in]pathFull path to the log file

This function directs the log output to the file identified by path. The previous log target, if any, is closed, and all new log messages will be written to the new log file.

If the function returns an error, the log target is not changed.

Returns
Zero on success, or a negative error code otherwise

◆ logSetLevel()

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

Set the log level.

Parameters
[in]categoryLogging category
[in]levelLog level

This function sets the log level of category to level. level shall be one of the following strings:

  • "DEBUG"
  • "INFO"
  • "WARN"
  • "ERROR"
  • "FATAL"

"*" is not a valid category for this function.

◆ logSetStream()

int libcamera::logSetStream ( std::ostream *  stream)

Direct logging to a stream.

Parameters
[in]streamStream to send log output to

This function directs the log output to stream. The previous log target, if any, is closed, and all new log messages will be written to the new log stream.

If the function returns an error, the log file is not changed

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

◆ logSetTarget()

int libcamera::logSetTarget ( LoggingTarget  target)

Set the logging target.

Parameters
[in]targetLogging destination

This function sets the logging output to the target specified by target. The allowed values of target are LoggingTargetNone and LoggingTargetSyslog. LoggingTargetNone will send the log output to nowhere, and LoggingTargetSyslog will send the log output to syslog. The previous log target, if any, is closed, and all new log messages will be written to the new log destination.

LoggingTargetFile and LoggingTargetStream are not valid values for target. Use logSetFile() and logSetStream() instead, respectively.

If the function returns an error, the log file is not changed.

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