- Initial creation.
This commit is contained in:
47
demo/Makefile
Normal file
47
demo/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
SRC := lgdemo.c
|
||||
TARGETS := lgdemo lgdemo-static
|
||||
FILE_BIN := lgdemo lgdemo-static
|
||||
FILE_LIB := lgdemo.dat
|
||||
|
||||
|
||||
|
||||
include ../Makefile.var
|
||||
include ../Makefile.rule
|
||||
|
||||
|
||||
|
||||
DEP_STATIC += ../lib/liblog.a
|
||||
DEP_DYNAMIC += ../lib/liblog.so
|
||||
INCLUDE += -I . -I ../include
|
||||
LIBDIR += -L . -L ../lib
|
||||
LIB_STATIC += ../lib/liblog.a
|
||||
LIB_DYNAMIC += -llog
|
||||
CFLAGS += -rdynamic
|
||||
|
||||
ifdef _LIBVER_SUPPORT
|
||||
DEP_STATIC += ../../libver/ver.h ../../libver/libver.a
|
||||
DEP_DYNAMIC += ../../libver/ver.h ../../libver/libver.so
|
||||
INCLUDE += -I ../../libver/lib
|
||||
LIBDIR += -L ../../libver/lib
|
||||
|
||||
ifeq ($(OSTYPE),linux-gnu)
|
||||
LIB_STATIC += ../../libver/lib/libver.a
|
||||
LIB_DYNAMIC += -lver
|
||||
else
|
||||
LIB_STATIC += ../../libver/lib/libver.a
|
||||
LIB_DYNAMIC += -lver
|
||||
endif
|
||||
|
||||
CFLAGS += -D_LIBVER_SUPPORT
|
||||
endif
|
||||
|
||||
ND_CHECK_FLAGS = -DND_MODE=0
|
||||
ND_NOCHECK_FLAGS = -DND_MODE=1
|
||||
|
||||
|
||||
|
||||
lgdemo: lgdemo.c $(DEP_DYNAMIC)
|
||||
$(CC) -o $@ $(CFLAGS) $(ND_NOCHECK_FLAGS) $(INCLUDE) $(LIBDIR) $(LIB_DYNAMIC) $<
|
||||
|
||||
lgdemo-static: lgdemo.c $(DEP_STATIC)
|
||||
$(CC) -o $@ $(CFLAGS) $(ND_NOCHECK_FLAGS) $(INCLUDE) $< $(LIB_STATIC)
|
||||
99
demo/lgdemo.c
Normal file
99
demo/lgdemo.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* lgdemo.c */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* This file is part of liblog. */
|
||||
/* */
|
||||
/* Drummer is free software: you can redistribute it and/or modify it */
|
||||
/* 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. */
|
||||
/* */
|
||||
/* Drummer 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 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/>. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Includes */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <log.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Definitions */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#define LGD_MODULE_NAME "dm"
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Prototypes */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
void demo_function( void);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Demo_Function */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* main */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
int main( int argc, char **argv)
|
||||
{
|
||||
LGT_Status status;
|
||||
|
||||
|
||||
if( ( status = LG_Library_Open( stderr, LGD_LOG_WRITER_DEFAULT, true)) != LGS_OK)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user