- Add function name in log info.

This commit is contained in:
Arnaud G. GIBERT 2024-04-18 00:03:12 +02:00
parent 17452c794b
commit 8a45c17dd1
4 changed files with 53 additions and 53 deletions

View File

@ -42,9 +42,9 @@
/*---------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* Prototypes */
/*---------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
void demo_function( void);
@ -52,9 +52,9 @@ void demo_function( void);
/*---------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* Demo_Function */
/*---------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
void Demo_Function( char *Name_Ptr)
{
LG_LOG_TRACE_1( LGD_LOG_LEVEL_DEFAULT, "Starting [%s]...", Name_Ptr);
@ -68,9 +68,9 @@ void Demo_Function( char *Name_Ptr)
/*---------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* main */
/*---------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
int main( int argc, char **argv)
{

View File

@ -101,39 +101,39 @@ typedef short LGT_Log_Level;
#define LGD_LOG_LEVEL_UNKNOWN ( LGT_Log_Level) 0
#define LGD_LOG_LEVEL_DEFAULT ( LGT_Log_Level) 1
#define LG_LOG_TRACE_0( Level, Fmt) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt))
#define LG_LOG_TRACE_1( Level, Fmt, Arg1) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1))
#define LG_LOG_TRACE_2( Level, Fmt, Arg1, Arg2) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2))
#define LG_LOG_TRACE_3( Level, Fmt, Arg1, Arg2, Arg3) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3))
#define LG_LOG_TRACE_4( Level, Fmt, Arg1, Arg2, Arg3, Arg4) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4))
#define LG_LOG_TRACE_5( Level, Fmt, Arg1, Arg2, Arg3, Arg4, Arg5) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5))
#define LG_LOG_TRACE_6( Level, Fmt, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5), (Arg6))
#define LG_LOG_TRACE_0( Level, Fmt) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt))
#define LG_LOG_TRACE_1( Level, Fmt, Arg1) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1))
#define LG_LOG_TRACE_2( Level, Fmt, Arg1, Arg2) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2))
#define LG_LOG_TRACE_3( Level, Fmt, Arg1, Arg2, Arg3) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3))
#define LG_LOG_TRACE_4( Level, Fmt, Arg1, Arg2, Arg3, Arg4) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4))
#define LG_LOG_TRACE_5( Level, Fmt, Arg1, Arg2, Arg3, Arg4, Arg5) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5))
#define LG_LOG_TRACE_6( Level, Fmt, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) LG_Log( LGD_LOG_TYPE_ID_TRACE, (Level), LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5), (Arg6))
#define LG_LOG_INFO_0( Fmt) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt))
#define LG_LOG_INFO_1( Fmt, Arg1) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1))
#define LG_LOG_INFO_2( Fmt, Arg1, Arg2) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2))
#define LG_LOG_INFO_3( Fmt, Arg1, Arg2, Arg3) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3))
#define LG_LOG_INFO_4( Fmt, Arg1, Arg2, Arg3, Arg4) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4))
#define LG_LOG_INFO_5( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5))
#define LG_LOG_INFO_6( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5), (Arg6))
#define LG_LOG_INFO_0( Fmt) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt))
#define LG_LOG_INFO_1( Fmt, Arg1) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1))
#define LG_LOG_INFO_2( Fmt, Arg1, Arg2) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2))
#define LG_LOG_INFO_3( Fmt, Arg1, Arg2, Arg3) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3))
#define LG_LOG_INFO_4( Fmt, Arg1, Arg2, Arg3, Arg4) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4))
#define LG_LOG_INFO_5( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5))
#define LG_LOG_INFO_6( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) LG_Log( LGD_LOG_TYPE_ID_INFO, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5), (Arg6))
#define LG_LOG_WARNING_0( Fmt) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt))
#define LG_LOG_WARNING_1( Fmt, Arg1) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1))
#define LG_LOG_WARNING_2( Fmt, Arg1, Arg2) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2))
#define LG_LOG_WARNING_3( Fmt, Arg1, Arg2, Arg3) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3))
#define LG_LOG_WARNING_4( Fmt, Arg1, Arg2, Arg3, Arg4) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4))
#define LG_LOG_WARNING_5( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5))
#define LG_LOG_WARNING_6( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5), (Arg6))
#define LG_LOG_WARNING_0( Fmt) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt))
#define LG_LOG_WARNING_1( Fmt, Arg1) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1))
#define LG_LOG_WARNING_2( Fmt, Arg1, Arg2) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2))
#define LG_LOG_WARNING_3( Fmt, Arg1, Arg2, Arg3) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3))
#define LG_LOG_WARNING_4( Fmt, Arg1, Arg2, Arg3, Arg4) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4))
#define LG_LOG_WARNING_5( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5))
#define LG_LOG_WARNING_6( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) LG_Log( LGD_LOG_TYPE_ID_WARNING, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5), (Arg6))
#define LG_LOG_ERROR_0( Fmt) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt))
#define LG_LOG_ERROR_1( Fmt, Arg1) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1))
#define LG_LOG_ERROR_2( Fmt, Arg1, Arg2) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2))
#define LG_LOG_ERROR_3( Fmt, Arg1, Arg2, Arg3) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3))
#define LG_LOG_ERROR_4( Fmt, Arg1, Arg2, Arg3, Arg4) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4))
#define LG_LOG_ERROR_5( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5))
#define LG_LOG_ERROR_6( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5), (Arg6))
#define LG_LOG_ERROR_0( Fmt) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt))
#define LG_LOG_ERROR_1( Fmt, Arg1) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1))
#define LG_LOG_ERROR_2( Fmt, Arg1, Arg2) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2))
#define LG_LOG_ERROR_3( Fmt, Arg1, Arg2, Arg3) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3))
#define LG_LOG_ERROR_4( Fmt, Arg1, Arg2, Arg3, Arg4) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4))
#define LG_LOG_ERROR_5( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5))
#define LG_LOG_ERROR_6( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) LG_Log( LGD_LOG_TYPE_ID_ERROR, LGD_LOG_LEVEL_DEFAULT, LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5), (Arg6))
#define LG_STACK_TRACE( Level) LG_Stack_Trace( (Level), LGD_MODULE_NAME, __FILE__, __LINE__, true)
#define LG_STACK_TRACE( Level) LG_Stack_Trace( (Level), LGD_MODULE_NAME, __FILE__, __LINE__, __func__, true)
@ -203,7 +203,7 @@ LGD_API LGT_Status LG_Log_Stream_Set( FILE *);
/* LG_Log */
/*----------------------------------------------------------------------------*/
LGD_API LGT_Status LG_Log( LGT_Log_Type_Id, LGT_Log_Level, char *, char *, long, bool, char *, ...);
LGD_API LGT_Status LG_Log( LGT_Log_Type_Id, LGT_Log_Level, char *, const char *, const long, const char *, bool, char *, ...);
@ -211,7 +211,7 @@ LGD_API LGT_Status LG_Log( LGT_Log_Type_Id, LGT_Log_Level, char *, char *, lo
/* LG_Stack_Trace_Print */
/*------------------------------------------------------------------------------*/
LGD_API LGT_Status LG_Stack_Trace( LGT_Log_Level, char *, char *, long, bool);
LGD_API LGT_Status LG_Stack_Trace( LGT_Log_Level, char *, const char *, const long, const char *, bool);

View File

@ -118,10 +118,10 @@ LGT_Status LG_Log_Header( LGT_Log_Type_Id Log_Type_Id, ...)
va_start( args, Log_Type_Id);
sprintf( fmt, "\nYY/MM/DD|hh:mm:ss.uuuu|Typ|Lev|Name| File Name |Line| Log Message\n");
sprintf( fmt, "\nYY/MM/DD|hh:mm:ss.uuuu|Typ|Lev|Name| File Name |Line| Function Name | Log Message\n");
status = ( *log_writer_ptr)( log_stream_out_ptr, Log_Type_Id, fmt, args);
sprintf( fmt, "--------+-------------+---+---+----+---------------------+----+-------------------------------------------------------------------\n");
sprintf( fmt, "--------+-------------+---+---+----+---------------------+----+----------------------------+-------------------------------------------------------------------\n");
status = ( *log_writer_ptr)( log_stream_out_ptr, Log_Type_Id, fmt, args);
va_end( args);
@ -151,7 +151,7 @@ LGT_Status LG_Log_Footer( LGT_Log_Type_Id Log_Type_Id, ...)
va_start( args, Log_Type_Id);
sprintf( fmt, "--------+-------------+---+---+----+---------------------+----+-------------------------------------------------------------------\n");
sprintf( fmt, "--------+-------------+---+---+----+---------------------+----+----------------------------+-------------------------------------------------------------------\n");
status = ( *log_writer_ptr)( log_stream_out_ptr, Log_Type_Id, fmt, args);
va_end( args);
@ -167,7 +167,7 @@ LGT_Status LG_Log_Footer( LGT_Log_Type_Id Log_Type_Id, ...)
/* LG_Log */
/*----------------------------------------------------------------------------*/
LGT_Status LG_Log( LGT_Log_Type_Id Log_Type_Id, LGT_Log_Level Log_Level, char *Module_Name, char *File_Name, long Line_Id, bool LF_Flag, char *Log_Fmt, ...)
LGT_Status LG_Log( LGT_Log_Type_Id Log_Type_Id, LGT_Log_Level Log_Level, char *Module_Name, const char *File_Name, const long Line_Id, const char *Function_Name, bool LF_Flag, char *Log_Fmt, ...)
{
va_list args;
char fmt[255];
@ -177,7 +177,7 @@ LGT_Status LG_Log( LGT_Log_Type_Id Log_Type_Id, LGT_Log_Level Log_Level, char
LGT_Status status;
if( LG_Log_Format( fmt, Log_Type_Id, Log_Level, Module_Name, File_Name, Line_Id, LF_Flag, Log_Fmt) != LGS_OK)
if( LG_Log_Format( fmt, Log_Type_Id, Log_Level, Module_Name, File_Name, Line_Id, Function_Name, LF_Flag, Log_Fmt) != LGS_OK)
{
fprintf( stderr, "LG_Log: Can't format log messages (%d)!!!\n", errno);
return( LGS_KO);
@ -203,7 +203,7 @@ LGT_Status LG_Log( LGT_Log_Type_Id Log_Type_Id, LGT_Log_Level Log_Level, char
/* LG_Log_Format */
/*----------------------------------------------------------------------------*/
LGT_Status LG_Log_Format( char *Out_Fmt, LGT_Log_Type_Id Log_Type_Id, LGT_Log_Level Log_Level, char *Module_Name, char *File_Name, long Line_Id, bool LF_Flag, char *Log_Fmt)
LGT_Status LG_Log_Format( char *Out_Fmt, LGT_Log_Type_Id Log_Type_Id, LGT_Log_Level Log_Level, char *Module_Name, const char *File_Name, const long Line_Id, const char *Function_Name, bool LF_Flag, char *Log_Fmt)
{
struct timeval cur_timeval;
struct tm *tm_ptr;
@ -218,9 +218,9 @@ LGT_Status LG_Log_Format( char *Out_Fmt, LGT_Log_Type_Id Log_Type_Id, LGT_Log
return( LGS_KO);
}
sprintf( Out_Fmt, "%02d/%02d/%02d %02d:%02d:%02d.%04d %3s %03d %-4s %-21s %-4d %s%s",
sprintf( Out_Fmt, "%02d/%02d/%02d %02d:%02d:%02d.%04d %3s %03d %-4s %-21s %-4d %-28s %s%s",
( tm_ptr->tm_year - 100), tm_ptr->tm_mon, tm_ptr->tm_mday, tm_ptr->tm_hour, tm_ptr->tm_min, tm_ptr->tm_sec, ( cur_timeval.tv_usec / 100),
LGG_Base.Log_Type_Name_Tab[ Log_Type_Id], Log_Level, Module_Name, File_Name, Line_Id,
LGG_Base.Log_Type_Name_Tab[ Log_Type_Id], Log_Level, Module_Name, File_Name, Line_Id, Function_Name,
Log_Fmt,
( ( LF_Flag == true) ? "\n" : ""));
@ -261,7 +261,7 @@ LGT_Status LG_Log_Write( FILE *Log_Stream_Out_Ptr, LGT_Log_Type_Id Log_Type_I
/* LG_Stack_Trace */
/*------------------------------------------------------------------------------*/
LGT_Status LG_Stack_Trace( LGT_Log_Level Log_Level, char *Module_Name, char *File_Name, long Line_Id, bool LF_Flag)
LGT_Status LG_Stack_Trace( LGT_Log_Level Log_Level, char *Module_Name, const char *File_Name, const long Line_Id, const char *Function_Name, bool LF_Flag)
{
void *array[100];
char **strings;
@ -273,14 +273,14 @@ LGT_Status LG_Stack_Trace( LGT_Log_Level Log_Level, char *Module_Name, char
if( strings != NULL)
{
LG_Log( LGD_LOG_TYPE_ID_TRACE, Log_Level, Module_Name, File_Name, Line_Id, LF_Flag, "*--- Stack Trace: Obtained %d stack frames ---*", size);
LG_Log( LGD_LOG_TYPE_ID_TRACE, Log_Level, Module_Name, File_Name, Line_Id, Function_Name, LF_Flag, "*--- Stack Trace: Obtained %d stack frames ---*", size);
for( i = 0; i < size; i++)
{
LG_Log( LGD_LOG_TYPE_ID_TRACE, Log_Level, Module_Name, File_Name, Line_Id, LF_Flag, "| %s", strings[i]);
LG_Log( LGD_LOG_TYPE_ID_TRACE, Log_Level, Module_Name, File_Name, Line_Id, Function_Name, LF_Flag, "| %s", strings[i]);
}
LG_Log( LGD_LOG_TYPE_ID_TRACE, Log_Level, Module_Name, File_Name, Line_Id, LF_Flag, "*----------------------------------------", size);
LG_Log( LGD_LOG_TYPE_ID_TRACE, Log_Level, Module_Name, File_Name, Line_Id, Function_Name, LF_Flag, "*----------------------------------------", size);
}
free( strings);

View File

@ -106,7 +106,7 @@ LGT_Status LG_Log_Footer( LGT_Log_Type_Id, ...);
/* LG_Log_Format */
/*----------------------------------------------------------------------------*/
LGT_Status LG_Log_Format( char *, LGT_Log_Type_Id, LGT_Log_Level, char *, char *, long, bool, char *);
LGT_Status LG_Log_Format( char *, LGT_Log_Type_Id, LGT_Log_Level, char *, const char *, const long, const char *, bool, char *);