Sturk 1.0.2
Publish-subscribe C implementation.
Loading...
Searching...
No Matches
trace.h File Reference

Trace. More...

#include "st/os/fstream.h"
Include dependency graph for trace.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ST_LOGGER_EN   0
 Logger enabled.
 
#define ST_TRACE(lvl, tag, ...)
 Log to the streams that are attached to the logger.
 

Enumerations

enum  StTraceLvl {
  ST_UNKNOWN = 0 , ST_DEBUG , ST_INFO , ST_WARNING ,
  ST_ERROR , ST_N_TRACE_LVLS
}
 Trace level. More...
 

Functions

void st_trace (enum StTraceLvl lvl, const char *tag, const char *format,...)
 Log to the file streams that are attached to the logger.
 
void st_logger_attach (enum StTraceLvl lvl, StFstream *stream)
 Attach a stream to the logger.
 
void st_logger_detach (enum StTraceLvl lvl, StFstream *stream)
 Detach a stream from the logger.
 
void st_logger_cleanup (void)
 Detach all streams and free all the memory allocated by the logger.
 

Detailed Description

Trace.

Macro Definition Documentation

◆ ST_TRACE

#define ST_TRACE (   lvl,
  tag,
  ... 
)
Value:
do { \
if (ST_LOGGER_EN) \
st_trace(lvl, tag, __VA_ARGS__); \
} while (0)
#define ST_LOGGER_EN
Logger enabled.
Definition trace.h:50

Log to the streams that are attached to the logger.

This is almost the same as st_trace(). The main difference is that it will not compile if the ST_LOGGER_EN is 0.

See also
st_trace()

Enumeration Type Documentation

◆ StTraceLvl

enum StTraceLvl

Trace level.

Enumerator
ST_UNKNOWN 

unknown trace level.


ST_DEBUG 

debug trace level.


ST_INFO 

info trace level.


ST_WARNING 

warning trace level.


ST_ERROR 

error trace level.


ST_N_TRACE_LVLS 

number of trace levels.

Function Documentation

◆ st_logger_attach()

void st_logger_attach ( enum StTraceLvl  lvl,
StFstream stream 
)

Attach a stream to the logger.

Parameters
[in]lvlThe trace level.
[in,out]streamThe stream.

◆ st_logger_detach()

void st_logger_detach ( enum StTraceLvl  lvl,
StFstream stream 
)

Detach a stream from the logger.

Parameters
[in]lvlThe trace level.
[in,out]streamThe stream.

◆ st_trace()

void st_trace ( enum StTraceLvl  lvl,
const char *  tag,
const char *  format,
  ... 
)

Log to the file streams that are attached to the logger.

Parameters
[in]lvlThe trace level.
[in]tagThe tag string.
[in]formatThe format string.
[in]...The list of arguments.