|
ILogSink * | getExternalSink () const |
|
LogLevel | getLevel () const |
|
MonotonicDuration | getTxTimeout () const |
|
int | init (const TransferPriority priority=TransferPriority::Lowest) |
|
int | log (const protocol::debug::LogMessage &message) |
|
| Logger (INode &node) |
|
void | setExternalSink (ILogSink *sink) |
|
void | setLevel (LogLevel level) |
|
void | setTxTimeout (MonotonicDuration val) |
|
|
template<typename... Args> |
int | log (LogLevel level, const char *source, const char *format, Args... args) UAVCAN_NOEXCEPT |
|
template<typename... Args> |
int | logDebug (const char *source, const char *format, Args... args) UAVCAN_NOEXCEPT |
|
template<typename... Args> |
int | logInfo (const char *source, const char *format, Args... args) UAVCAN_NOEXCEPT |
|
template<typename... Args> |
int | logWarning (const char *source, const char *format, Args... args) UAVCAN_NOEXCEPT |
|
template<typename... Args> |
int | logError (const char *source, const char *format, Args... args) UAVCAN_NOEXCEPT |
|
Node logging convenience class.
This class is based on the standard UAVCAN message type for logging - uavcan.protocol.debug.LogMessage.
Provides logging methods of different severity; implements two sinks for the log messages:
- Broadcast via the UAVCAN bus;
- Sink into the application via ILogSink.
For each sink an individual severity threshold filter can be configured.
Definition at line 58 of file logger.hpp.
int uavcan::Logger::log |
( |
const protocol::debug::LogMessage & |
message | ) |
|
|
inline |
Logs one message. Please consider using helper methods instead of this one.
The message will be broadcasted via the UAVCAN bus if the severity level of the message is >= severity level of the logger.
The message will be reported into the external log sink if the external sink is installed and the severity level of the message is >= severity level of the external sink.
Returns negative error code.
Definition at line 118 of file logger.hpp.
template<typename... Args>
int uavcan::Logger::log |
( |
LogLevel |
level, |
|
|
const char * |
source, |
|
|
const char * |
format, |
|
|
Args... |
args |
|
) |
| |
Helper methods for various severity levels and with formatting support. These methods build a formatted log message and pass it into the method log().
Format string usage is a bit unusual: use "%*" for any argument type, use "%%" to print a percent character. No other formating options are supported. Insufficient/extra arguments are ignored.
Example format string: "What do you get if you %* %* by %*? %*. Extra arguments: %* %* %%" ...with the following arguments: "multiply", 6, 9.0F 4.2e1 ...will likely produce this (floating point representation is platform dependent): "What do you get if you multiply 6 by 9.000000? 42.000000. Extra arguments: %* %* %"
Formatting is not supported in C++03 mode.
Definition at line 257 of file logger.hpp.