Fixposition SDK 0.0.0-heads/main-0-g7b59b93
Collection of c++ libraries and apps for use with Fixposition products
Loading...
Searching...
No Matches
logging.hpp File Reference

Fixposition SDK: Logging. More...

#include <cinttypes>
#include <cstdarg>
#include <sstream>
#include "string.hpp"
Include dependency graph for logging.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fpsdk::common::logging::LoggingParams
 Logging parameters. More...
 

Namespaces

namespace  fpsdk
 Fixposition SDK.
 
namespace  fpsdk::common
 Fixposition SDK: Common library.
 
namespace  fpsdk::common::logging
 Logging.
 

Macros

Printf() style logging

For example: INFO("Hello world, the number is %d", 42);

#define FATAL(fmt, ...)
 Print a fatal message.
 
#define ERROR(fmt, ...)
 Print a error message.
 
#define WARNING(fmt, ...)
 Print a warning message.
 
#define NOTICE(fmt, ...)
 Print a notice message.
 
#define INFO(fmt, ...)
 Print a info message.
 
#define DEBUG(fmt, ...)
 Print a debug message.
 
#define DEBUG_HEXDUMP(data, size, prefix, fmt, ...)
 Print a debug hexdump.
 
#define TRACE(fmt, ...)
 Print a trace message (only debug builds, compiled out in release builds)
 
#define TRACE_HEXDUMP(data, size, prefix, fmt, ...)
 Print a trace hexdump (only debug builds, compiled out in release builds)
 
C++ style logging

For example, INFO_S("Hello world, the number is " << 42);

#define FATAL_S(expr)
 Print a fatal message.
 
#define ERROR_S(expr)
 Print a error message.
 
#define WARNING_S(expr)
 Print a warning message.
 
#define DEBUG_S(expr)
 Print a debug message.
 
#define NOTICE_S(expr)
 Print a notice message.
 
#define INFO_S(expr)
 Print a info message.
 
#define TRACE_S(expr)
 Print a trace message (only debug builds, compiled out in release builds)
 

Typedefs

using fpsdk::common::logging::LoggingPrintFunc = void (*)(const LoggingParams&, const LoggingLevel, const char*)
 Custom logging print function signature.
 

Enumerations

enum class  fpsdk::common::logging::LoggingLevel {
  fpsdk::common::logging::FATAL , fpsdk::common::logging::ERROR , fpsdk::common::logging::WARNING , fpsdk::common::logging::NOTICE ,
  fpsdk::common::logging::INFO , fpsdk::common::logging::DEBUG , fpsdk::common::logging::TRACE
}
 Logging verbosity levels, default is INFO. More...
 
enum class  fpsdk::common::logging::LoggingColour { fpsdk::common::logging::AUTO = 0 , fpsdk::common::logging::YES , fpsdk::common::logging::NO , fpsdk::common::logging::JOURNAL }
 Logging "colours". More...
 

Functions

LoggingLevelfpsdk::common::logging::operator++ (LoggingLevel &level)
 Increase verbosity (pre-increment)
 
LoggingLevelfpsdk::common::logging::operator-- (LoggingLevel &level)
 Decrease verbosity (pre-decrement)
 
LoggingLevel fpsdk::common::logging::operator++ (LoggingLevel &level, int)
 Increase verbosity (post-increment)
 
LoggingLevel fpsdk::common::logging::operator-- (LoggingLevel &level, int)
 Decrease verbosity (post-decrement)
 
const char * fpsdk::common::logging::LoggingLevelStr (const LoggingLevel level)
 Stringify log level.
 
bool fpsdk::common::logging::LoggingIsLevel (const LoggingLevel level)
 Check if given level would print.
 
LoggingParams fpsdk::common::logging::LoggingSetParams (const LoggingParams &params)
 Configure logging.
 
LoggingParams fpsdk::common::logging::LoggingGetParams ()
 Get current logging params.
 
void fpsdk::common::logging::LoggingPrint (const LoggingLevel level, const char *fmt,...) PRINTF_ATTR(2)
 Print a log message.
 
void fpsdk::common::logging::LoggingHexdump (const LoggingLevel level, const uint8_t *data, const uint64_t size, const char *prefix, const char *fmt,...) PRINTF_ATTR(5)
 Print a hexdump.
 

Detailed Description

Fixposition SDK: Logging.

* ___    ___
* \  \  /  /
*  \  \/  /   Copyright (c) Fixposition AG (www.fixposition.com) and contributors
*  /  /\  \   License: see the LICENSE file
* /__/  \__\
* 

Definition in file logging.hpp.

Macro Definition Documentation

◆ FATAL

#define FATAL ( fmt,
... )

Print a fatal message.

Definition at line 50 of file logging.hpp.

◆ ERROR

#define ERROR ( fmt,
... )

Print a error message.

Definition at line 54 of file logging.hpp.

◆ WARNING

#define WARNING ( fmt,
... )

Print a warning message.

Definition at line 58 of file logging.hpp.

Referenced by fpsdk::apps::fpltool::FplToolOptions::CheckOptions().

◆ NOTICE

#define NOTICE ( fmt,
... )

Print a notice message.

Definition at line 62 of file logging.hpp.

◆ INFO

#define INFO ( fmt,
... )

Print a info message.

Definition at line 66 of file logging.hpp.

◆ DEBUG

#define DEBUG ( fmt,
... )

Print a debug message.

Definition at line 70 of file logging.hpp.

Referenced by fpsdk::apps::fpltool::FplToolOptions::CheckOptions().

◆ DEBUG_HEXDUMP

#define DEBUG_HEXDUMP ( data,
size,
prefix,
fmt,
... )

Print a debug hexdump.

Definition at line 74 of file logging.hpp.

◆ TRACE

#define TRACE ( fmt,
... )

Print a trace message (only debug builds, compiled out in release builds)

Definition at line 79 of file logging.hpp.

◆ TRACE_HEXDUMP

#define TRACE_HEXDUMP ( data,
size,
prefix,
fmt,
... )

Print a trace hexdump (only debug builds, compiled out in release builds)

Definition at line 83 of file logging.hpp.

◆ FATAL_S

#define FATAL_S ( expr)

Print a fatal message.

Definition at line 102 of file logging.hpp.

◆ ERROR_S

#define ERROR_S ( expr)

Print a error message.

Definition at line 107 of file logging.hpp.

◆ WARNING_S

#define WARNING_S ( expr)

Print a warning message.

Definition at line 112 of file logging.hpp.

◆ DEBUG_S

#define DEBUG_S ( expr)

Print a debug message.

Definition at line 117 of file logging.hpp.

◆ NOTICE_S

#define NOTICE_S ( expr)

Print a notice message.

Definition at line 122 of file logging.hpp.

◆ INFO_S

#define INFO_S ( expr)

Print a info message.

Definition at line 127 of file logging.hpp.

◆ TRACE_S

#define TRACE_S ( expr)

Print a trace message (only debug builds, compiled out in release builds)

Definition at line 133 of file logging.hpp.