41static const char*_timestamp(
const char* p_File,
42 const unsigned int p_Line,
43 const char* p_CompilDate,
44 const char* p_CompilTime,
45 const char* p_Function)
49 static char l_tmp[110];
50 time_t l_CurrentTime = time(
NULL);
54 if ((
NULL==p_File)|| (0==p_File[0])||
56 (
NULL==p_CompilDate)|| (0==p_CompilDate[0])||
57 (
NULL==p_CompilTime)|| (0==p_CompilTime[0])||
58 (
NULL==p_Function)|| (0==p_Function[0])) {
59 fprintf(stderr,
"%s:%d Unexpected and invalid parameters\n",__FILE__, __LINE__);
63 strftime(l_Time,
sizeof(l_Time),
"%Y-%m-%d %H:%M:%S", localtime(&l_CurrentTime));
67 snprintf(l_tmp,
sizeof(l_tmp),
68 "%19s [%20s:%-4ud] (%11s @ %8s) %30s()",
69 l_Time,p_File,p_Line,p_CompilDate,p_CompilTime,p_Function
76 const unsigned int p_Line,
77 const char* p_CompilDate,
78 const char* p_CompilTime,
const char* p_Function)
81 fprintf (stderr,
"%s\n",
82 _timestamp( p_File, p_Line, p_CompilDate, p_CompilTime, p_Function)
88 const unsigned int p_Line,
89 const char* p_CompilDate,
90 const char* p_CompilTime,
91 const char* p_Function,
const char* p_Message)
94 fprintf (stderr,
"%s : %s\n",
95 _timestamp( p_File, p_Line, p_CompilDate, p_CompilTime, p_Function),
102 const unsigned int p_Line,
103 const char* p_CompilDate,
104 const char* p_CompilTime,
105 const char* p_Function,
const char* p_Format, ...
111 unsigned int l_length;
117 va_start(l_ap, p_Format);
119 l_length = vsnprintf(l_tmp,
sizeof(l_tmp),p_Format,l_ap);
123 if (l_length >=
sizeof(l_tmp)-1) {
125 strcpy(&(l_tmp[
sizeof(l_tmp)-6]),
"[...]");
129 fprintf (stderr,
"%s : %s\n",
130 _timestamp( p_File, p_Line, p_CompilDate, p_CompilTime, p_Function),
void _trace_dynmsg(const char *p_File, const unsigned int p_Line, const char *p_CompilDate, const char *p_CompilTime, const char *p_Function, const char *p_Format,...)
Print a debug trace (checkpoint) with a formatted message.
void _trace_msg(const char *p_File, const unsigned int p_Line, const char *p_CompilDate, const char *p_CompilTime, const char *p_Function, const char *p_Message)
Print a debug trace (checkpoint) with a static message.
void _trace(const char *p_File, const unsigned int p_Line, const char *p_CompilDate, const char *p_CompilTime, const char *p_Function)
Print a debug trace (checkpoint)