liblog/demo/lgdemo.c

102 lines
3.9 KiB
C
Raw Normal View History

2024-04-17 10:50:09 +02:00
/*----------------------------------------------------------------------------*/
/* lgdemo.c */
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* This file is part of LibLog. */
2024-04-17 10:50:09 +02:00
/* */
/* LibLog is free software: you can redistribute it and/or modify it */
2024-04-17 10:50:09 +02:00
/* under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* LibLog is distributed in the hope that it will be useful, */
2024-04-17 10:50:09 +02:00
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with Drummer. If not, see <https://www.gnu.org/licenses/>. */
/*----------------------------------------------------------------------------*/
2024-04-17 10:50:09 +02:00
/*----------------------------------------------------------------------------*/
/* Includes */
/*----------------------------------------------------------------------------*/
#include <stdio.h>
#include <log.h>
/*----------------------------------------------------------------------------*/
/* Definitions */
/*----------------------------------------------------------------------------*/
#define LGD_MODULE_NAME "dm"
2024-04-18 00:03:12 +02:00
/*----------------------------------------------------------------------------*/
/* Prototypes */
/*----------------------------------------------------------------------------*/
2024-04-17 10:50:09 +02:00
void demo_function( void);
2024-04-18 00:03:12 +02:00
/*----------------------------------------------------------------------------*/
/* Demo_Function */
/*----------------------------------------------------------------------------*/
2024-04-17 10:50:09 +02:00
void Demo_Function( char *Name_Ptr)
{
LG_LOG_TRACE_1( LGD_LOG_LEVEL_DEFAULT, "Starting [%s]...", Name_Ptr);
LG_STACK_TRACE( LGD_LOG_LEVEL_DEFAULT);
LG_LOG_TRACE_1( LGD_LOG_LEVEL_DEFAULT, "Completed [%s]!", Name_Ptr);
}
2024-04-18 00:03:12 +02:00
/*----------------------------------------------------------------------------*/
/* main */
/*----------------------------------------------------------------------------*/
2024-04-17 10:50:09 +02:00
int main( int argc, char **argv)
{
LGT_Status status;
if( ( status = LG_Library_Open( LGD_LOG_WRITER_DEFAULT, true)) != LGS_OK)
2024-04-17 10:50:09 +02:00
{
fprintf( stderr, "Can't open LibLog library: (%d)\n", status);
return( -1);
}
else
{
LG_LOG_TRACE_1( LGD_LOG_LEVEL_DEFAULT, "This is an trace message #: (%d)", 1);
LG_LOG_INFO_1( "This is an info message #: (%d)", 2);
LG_LOG_WARNING_1( "This is an warning message #: (%d)", 3);
LG_LOG_ERROR_1( "This is an error message #: (%d)", 4);
Demo_Function( "Demo_Function");
if( ( status = LG_Library_Close( true)) != LGS_OK)
{
fprintf( stderr, "Can't close LibLog library: (%d)\n", status);
return( -1);
}
}
}