LAR Library: log.h Source File

LAR Library

log.h
Go to the documentation of this file.
1 #ifndef LARLIB_LOG_H
2 #define LARLIB_LOG_H
3 
112 #include <larlib/base.h>
113 #include <stdarg.h>
114 
119  LOG_DEBUG = 0x0000,
120  LOG_INFO = 0x2000,
121  LOG_WARNING = 0x4000,
122  LOG_ERROR = 0x6000,
123  LOG_CRITICAL = 0x8000,
124  LOG_ALWAYS = 0xFF00
125 };
126 
132  LOG_CH_BASE = 200,
142 };
143 
148 #define LOG_ALL_CHANNELS 0, 256
149 
162 typedef int (*logWriteFunction_t)(void *context, uint16_t channelLevel,
163  const char *msg, int msgLength);
164 
180  void *context, uint16_t channelLevel,
181  const void *data, int dataLen);
182 
191 #ifndef NDEBUG
192 #define LOG_ASSERT(cond) ((void) ((!!(cond)) || (logAssertImpl(#cond, __LINE__, __FILE__), 0)))
193 #else
194 #define LOG_ASSERT(cond)
195 #endif
196 
197 /*
198  * Implementation detail -- this function prints the assertion message
199  * \p condStr plus the line number \p line and the file name \p file
200  * and resets the device.
201  */
202 void logAssertImpl(const char *condStr, int line, const char *file);
203 
233 int logWriteTeliumTrace(void *context, uint16_t channelLevel, const char *msg, int msgLength);
234 
252 int logWriteTeliumRemoteDebugger(void *context, uint16_t channelLevel, const char *msg, int msgLength);
253 
271  void *context, uint16_t channelLevel,
272  const void *data, int dataLen);
273 
323 int logSetChannels(uint8_t firstChannel, int numChannels, uint16_t level,
324  logWriteFunction_t writeFunction,
325  logDumpFunction_t dumpFormatFunction,
326  void *context);
327 
343 int logChannelIsEnabled(uint16_t channelLevel);
344 
374 int logPrintf(uint16_t channelLevel, const char *fmt, ...);
375 
390 int logPrintvf(uint16_t channelLevel, const char *fmt, va_list va);
391 
406 int logDump(uint16_t channelLevel, const void *buffer, int size);
407 
408 /* @} */
409 
410 #endif
int logPrintf(uint16_t channelLevel, const char *fmt,...)
sprintf() like formatted traces.
Run-time warnings.
Definition: log.h:121
Always write (if channel is enabled)
Definition: log.h:124
int(* logDumpFunction_t)(logWriteFunction_t write, void *context, uint16_t channelLevel, const void *data, int dataLen)
Type of function called to format the output on logDump().
Definition: log.h:179
int logWriteTeliumTrace(void *context, uint16_t channelLevel, const char *msg, int msgLength)
A logWriteFunction_t that can be used as parameter to logSetChannels() and writes traces using Telium...
Conversion routines
Definition: log.h:133
Multi-threading
Definition: log.h:141
int logDumpFormattedAscii(logWriteFunction_t write, void *context, uint16_t channelLevel, const void *data, int dataLen)
dumpFormatFunction that formats the received buffer as a two-column hexadecimal and ASCII display and...
logReservedChannels_t
List of reserved log channels.
Definition: log.h:131
Critical.
Definition: log.h:123
Table Management
Definition: log.h:138
Lowest-priority: only for debugging.
Definition: log.h:119
Run-time errors.
Definition: log.h:122
File System
Definition: log.h:135
Buffer formatting
Definition: log.h:140
INI file parsing
Definition: log.h:136
int logSetChannels(uint8_t firstChannel, int numChannels, uint16_t level, logWriteFunction_t writeFunction, logDumpFunction_t dumpFormatFunction, void *context)
Configures one or more tracing channels.
int logWriteTeliumRemoteDebugger(void *context, uint16_t channelLevel, const char *msg, int msgLength)
A logWriteFunction_t that can be used as parameter to logSetChannels() and writes traces to the Remot...
Basic Definitions and LOG_ASSERT()
Definition: log.h:132
Memory Management
Definition: log.h:137
unsigned short uint16_t
Unsigned 16-bit integer.
Definition: base.h:165
int logPrintvf(uint16_t channelLevel, const char *fmt, va_list va)
A version of logPrintf() that accepts a va_list as parameter.
int logDump(uint16_t channelLevel, const void *buffer, int size)
Write a block of data as a binary dump.
Larlib basic definitions.
Date and time
Definition: log.h:134
Informative.
Definition: log.h:120
State-machine
Definition: log.h:139
logLevel_t
General tracing levels.
Definition: log.h:118
int(* logWriteFunction_t)(void *context, uint16_t channelLevel, const char *msg, int msgLength)
Type of the function that does the actual writing on a trace channel.
Definition: log.h:162
int logChannelIsEnabled(uint16_t channelLevel)
Check if a log channel is enabled for a specific priority level.
unsigned char uint8_t
Unsigned 8-bit integer.
Definition: base.h:162
Generated on Mon Mar 27 2017 15:42:52 for LAR Library by   doxygen 1.8.9.1