SoapySDR: Logger.h File Reference

| SoapySDR 0.8.1-ARCH Vendor and platform neutral SDR interface library

Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions
Logger.h File Reference
`#include <SoapySDR/Config.h>`
`#include <stdarg.h>`

Go to the source code of this file.

## Macros
#define | SOAPY_SDR_SSI SOAPY_SDR_SSI
| Compile-time detection macro for SSI feature.

## Typedefs
typedef void(* | SoapySDRLogHandler) (const SoapySDRLogLevel logLevel, const char *message)

## Enumerations
enum | SoapySDRLogLevel { SOAPY_SDR_FATAL = 1 , SOAPY_SDR_CRITICAL = 2 , SOAPY_SDR_ERROR = 3 , SOAPY_SDR_WARNING = 4 , SOAPY_SDR_NOTICE = 5 , SOAPY_SDR_INFO = 6 , SOAPY_SDR_DEBUG = 7 , SOAPY_SDR_TRACE = 8 , SOAPY_SDR_SSI = 9 }

## Functions
SOAPY_SDR_API void | SoapySDR_log (const SoapySDRLogLevel logLevel, const char *message)
SOAPY_SDR_API void | SoapySDR_vlogf (const SoapySDRLogLevel logLevel, const char *format, va_list argList)
static void | SoapySDR_logf (const SoapySDRLogLevel logLevel, const char *format,...)
SOAPY_SDR_API void | SoapySDR_registerLogHandler (const SoapySDRLogHandler handler)
SOAPY_SDR_API void | SoapySDR_setLogLevel (const SoapySDRLogLevel logLevel)
SOAPY_SDR_API SoapySDRLogLevel | SoapySDR_getLogLevel (void)

## Detailed Description

Logger API for SoapySDR devices. Implementations should use the logger rather than stdio. The default log handler prints to stderr.

Copyright
  Copyright (c) 2014-2015 Josh Blum 2022 Nicholas Corgan SPDX-License-Identifier: BSL-1.0

## Macro Definition Documentation

## ◆ SOAPY_SDR_SSI

#define SOAPY_SDR_SSI SOAPY_SDR_SSI

Compile-time detection macro for SSI feature.

## Typedef Documentation

## ◆ SoapySDRLogHandler

typedef void(* SoapySDRLogHandler) (const SoapySDRLogLevel logLevel, const char *message)

Typedef for the registered log handler function.

## Enumeration Type Documentation

## ◆ SoapySDRLogLevel

enum SoapySDRLogLevel

The available priority levels for log messages.

The default log level threshold is SOAPY_SDR_INFO. Log messages with lower priorities are dropped.

The default threshold can be set via the SOAPY_SDR_LOG_LEVEL environment variable. Set SOAPY_SDR_LOG_LEVEL to the string value: "WARNING", "ERROR", "DEBUG", etc... or set it to the equivalent integer value.

Enumerator
SOAPY_SDR_FATAL | A fatal error. The application will most likely terminate. This is the highest priority.
SOAPY_SDR_CRITICAL | A critical error. The application might not be able to continue running successfully.
SOAPY_SDR_ERROR | An error. An operation did not complete successfully, but the application as a whole is not affected.
SOAPY_SDR_WARNING | A warning. An operation completed with an unexpected result.
SOAPY_SDR_NOTICE | A notice, which is an information with just a higher priority.
SOAPY_SDR_INFO | An informational message, usually denoting the successful completion of an operation.
SOAPY_SDR_DEBUG | A debugging message.
SOAPY_SDR_TRACE | A tracing message. This is the lowest priority.
SOAPY_SDR_SSI | Streaming status indicators such as "U" (underflow) and "O" (overflow).

## Function Documentation

## ◆ SoapySDR_getLogLevel()

SOAPY_SDR_API SoapySDRLogLevel SoapySDR_getLogLevel | ( | void |  | ) |

Get the log level threshold.

## ◆ SoapySDR_log()

SOAPY_SDR_API void SoapySDR_log | ( | const SoapySDRLogLevel | logLevel,
|  | const char * | message )

Send a message to the registered logger.

Parameters

  logLevel | a possible logging level
  message | a logger message string

## ◆ SoapySDR_logf()

void SoapySDR_logf | ( | const SoapySDRLogLevel | logLevel,
|  | const char * | format,
|  |  | ... )
| inlinestatic

Send a message to the registered logger.

Parameters

  logLevel | a possible logging level
  format | a printf style format string

## ◆ SoapySDR_registerLogHandler()

SOAPY_SDR_API void SoapySDR_registerLogHandler | ( | const SoapySDRLogHandler | handler | ) |

Register a new system log handler. Platforms should call this to replace the default stdio handler. Passing NULL restores the default.

## ◆ SoapySDR_setLogLevel()

SOAPY_SDR_API void SoapySDR_setLogLevel | ( | const SoapySDRLogLevel | logLevel | ) |

Set the log level threshold. Log messages with lower priority are dropped.

## ◆ SoapySDR_vlogf()

SOAPY_SDR_API void SoapySDR_vlogf | ( | const SoapySDRLogLevel | logLevel,
|  | const char * | format,
|  | va_list | argList )

Send a message to the registered logger.

Parameters

  logLevel | a possible logging level
  format | a printf style format string
  argList | an argument list for the formatter