- Make private default Log_Writer function,

- Make private LGG_Base,
- Add LG_Log_Stream_Get/Set API,
- Minor file header fixies.
This commit is contained in:
2024-04-17 17:52:43 +02:00
parent 29ff5acb9f
commit 17452c794b
4 changed files with 144 additions and 78 deletions

View File

@@ -3,14 +3,14 @@
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* This file is part of liblog. */
/* This file is part of LibLog. */
/* */
/* Drummer is free software: you can redistribute it and/or modify it */
/* LibLog is free software: you can redistribute it and/or modify it */
/* under the terms of the GNU Lesser General Public License as published */
/* by the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* Drummer is distributed in the hope that it will be useful, */
/* LibLog is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU Lesser General Public License for more details. */
@@ -20,6 +20,8 @@
/* <https://www.gnu.org/licenses/>. */
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* Includes */
/*----------------------------------------------------------------------------*/
@@ -47,14 +49,6 @@
/*----------------------------------------------------------------------------*/
/* Global definitions */
/*----------------------------------------------------------------------------*/
#define LGD_LOG_WRITER_DEFAULT LG_Log_Write
/*----------------------------------------------------------------------------*/
/* Definitions */
/*----------------------------------------------------------------------------*/
@@ -144,23 +138,18 @@ typedef short LGT_Log_Level;
/*---------------------------------------------------------------------------------*/
/* LGT_Base */
/*---------------------------------------------------------------------------------*/
typedef LGT_Status (*LGT_Log_Writer_Ptr)( LGT_Log_Type_Id, char *, va_list);
/*----------------------------------------------------------------------------*/
/* Log Writer */
/*----------------------------------------------------------------------------*/
typedef struct LGT_Base
{
FILE *Log_Stream_Out_Ptr;
char *Log_Type_Name_Tab[ LGD_LOG_TYPE_NB];
LGT_Log_Writer_Ptr Log_Writer_Ptr;
} LGT_Base;
typedef LGT_Status (*LGT_Log_Writer_Ptr)( FILE *, LGT_Log_Type_Id, char *, va_list);
#define LGD_LOG_STREAM_DEFAULT ( FILE *)NULL
#define LGD_LOG_WRITER_DEFAULT ( LGT_Log_Writer_Ptr)NULL
LGD_API LGT_Base LGG_Base;
@@ -172,12 +161,11 @@ LGD_API LGT_Base LGG_Base;
/*----------------------------------------------------------------------------*/
/* LG_Library_Open */
/*----------------------------------------------------------------------------*/
/* (I) Log_Stream_Out_Ptr: Log output stream */
/* (I) Log_Writer_Ptr: Log writer pointer */
/* (I) Header_Print_Flag: Start by printing an header */
/*----------------------------------------------------------------------------*/
LGD_API LGT_Status LG_Library_Open( FILE *, LGT_Log_Writer_Ptr, bool);
LGD_API LGT_Status LG_Library_Open( LGT_Log_Writer_Ptr, bool);
@@ -191,6 +179,26 @@ LGD_API LGT_Status LG_Library_Close( bool);
/*----------------------------------------------------------------------------*/
/* LG_Log_Stream_Get */
/*----------------------------------------------------------------------------*/
/* (O) Log_Stream_Ptr_Ptr: Log output stream */
/*----------------------------------------------------------------------------*/
LGD_API LGT_Status LG_Log_Stream_Get( FILE **);
/*----------------------------------------------------------------------------*/
/* LG_Log_Stream_Set */
/*----------------------------------------------------------------------------*/
/* (I) Log_Stream_Ptr: Log output stream */
/*----------------------------------------------------------------------------*/
LGD_API LGT_Status LG_Log_Stream_Set( FILE *);
/*----------------------------------------------------------------------------*/
/* LG_Log */
/*----------------------------------------------------------------------------*/
@@ -199,14 +207,6 @@ LGD_API LGT_Status LG_Log( LGT_Log_Type_Id, LGT_Log_Level, char *, char *, lo
/*----------------------------------------------------------------------------*/
/* LG_Log_Write */
/*----------------------------------------------------------------------------*/
LGD_API LGT_Status LG_Log_Write( LGT_Log_Type_Id, char *, va_list);
/*------------------------------------------------------------------------------*/
/* LG_Stack_Trace_Print */
/*------------------------------------------------------------------------------*/