added a tester for logging functions
This commit is contained in:
parent
bcc9da7aca
commit
dae0fc8adb
@ -14,6 +14,7 @@ bin_PROGRAMS = \
|
|||||||
fs02 \
|
fs02 \
|
||||||
fs03 \
|
fs03 \
|
||||||
glob01 \
|
glob01 \
|
||||||
|
log01 \
|
||||||
nwad01 \
|
nwad01 \
|
||||||
nwif01 \
|
nwif01 \
|
||||||
nwif02 \
|
nwif02 \
|
||||||
@ -42,6 +43,7 @@ fs01_SOURCES = fs01.c
|
|||||||
fs02_SOURCES = fs02.c
|
fs02_SOURCES = fs02.c
|
||||||
fs03_SOURCES = fs03.c
|
fs03_SOURCES = fs03.c
|
||||||
glob01_SOURCES = glob01.c
|
glob01_SOURCES = glob01.c
|
||||||
|
log01_SOURCES = log01.c
|
||||||
nwad01_SOURCES = nwad01.c
|
nwad01_SOURCES = nwad01.c
|
||||||
nwif01_SOURCES = nwif01.c
|
nwif01_SOURCES = nwif01.c
|
||||||
nwif02_SOURCES = nwif02.c
|
nwif02_SOURCES = nwif02.c
|
||||||
|
@ -90,7 +90,7 @@ build_triplet = @build@
|
|||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
bin_PROGRAMS = aio01$(EXEEXT) dir01$(EXEEXT) fio01$(EXEEXT) \
|
bin_PROGRAMS = aio01$(EXEEXT) dir01$(EXEEXT) fio01$(EXEEXT) \
|
||||||
fio02$(EXEEXT) fs01$(EXEEXT) fs02$(EXEEXT) fs03$(EXEEXT) \
|
fio02$(EXEEXT) fs01$(EXEEXT) fs02$(EXEEXT) fs03$(EXEEXT) \
|
||||||
glob01$(EXEEXT) nwad01$(EXEEXT) nwif01$(EXEEXT) \
|
glob01$(EXEEXT) log01$(EXEEXT) nwad01$(EXEEXT) nwif01$(EXEEXT) \
|
||||||
nwif02$(EXEEXT) pio01$(EXEEXT) rwl01$(EXEEXT) sio01$(EXEEXT) \
|
nwif02$(EXEEXT) pio01$(EXEEXT) rwl01$(EXEEXT) sio01$(EXEEXT) \
|
||||||
sio02$(EXEEXT) sio03$(EXEEXT) task01$(EXEEXT)
|
sio02$(EXEEXT) sio03$(EXEEXT) task01$(EXEEXT)
|
||||||
@WCHAR_TRUE@@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
|
@WCHAR_TRUE@@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
|
||||||
@ -151,6 +151,10 @@ am_glob01_OBJECTS = glob01.$(OBJEXT)
|
|||||||
glob01_OBJECTS = $(am_glob01_OBJECTS)
|
glob01_OBJECTS = $(am_glob01_OBJECTS)
|
||||||
glob01_LDADD = $(LDADD)
|
glob01_LDADD = $(LDADD)
|
||||||
glob01_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
|
glob01_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
|
||||||
|
am_log01_OBJECTS = log01.$(OBJEXT)
|
||||||
|
log01_OBJECTS = $(am_log01_OBJECTS)
|
||||||
|
log01_LDADD = $(LDADD)
|
||||||
|
log01_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
|
||||||
am_nwad01_OBJECTS = nwad01.$(OBJEXT)
|
am_nwad01_OBJECTS = nwad01.$(OBJEXT)
|
||||||
nwad01_OBJECTS = $(am_nwad01_OBJECTS)
|
nwad01_OBJECTS = $(am_nwad01_OBJECTS)
|
||||||
nwad01_LDADD = $(LDADD)
|
nwad01_LDADD = $(LDADD)
|
||||||
@ -223,16 +227,16 @@ am__v_CCLD_0 = @echo " CCLD " $@;
|
|||||||
am__v_CCLD_1 =
|
am__v_CCLD_1 =
|
||||||
SOURCES = $(aio01_SOURCES) $(dir01_SOURCES) $(fio01_SOURCES) \
|
SOURCES = $(aio01_SOURCES) $(dir01_SOURCES) $(fio01_SOURCES) \
|
||||||
$(fio02_SOURCES) $(fs01_SOURCES) $(fs02_SOURCES) \
|
$(fio02_SOURCES) $(fs01_SOURCES) $(fs02_SOURCES) \
|
||||||
$(fs03_SOURCES) $(glob01_SOURCES) $(nwad01_SOURCES) \
|
$(fs03_SOURCES) $(glob01_SOURCES) $(log01_SOURCES) \
|
||||||
$(nwif01_SOURCES) $(nwif02_SOURCES) $(pio01_SOURCES) \
|
$(nwad01_SOURCES) $(nwif01_SOURCES) $(nwif02_SOURCES) \
|
||||||
$(rwl01_SOURCES) $(sio01_SOURCES) $(sio02_SOURCES) \
|
$(pio01_SOURCES) $(rwl01_SOURCES) $(sio01_SOURCES) \
|
||||||
$(sio03_SOURCES) $(task01_SOURCES)
|
$(sio02_SOURCES) $(sio03_SOURCES) $(task01_SOURCES)
|
||||||
DIST_SOURCES = $(aio01_SOURCES) $(dir01_SOURCES) $(fio01_SOURCES) \
|
DIST_SOURCES = $(aio01_SOURCES) $(dir01_SOURCES) $(fio01_SOURCES) \
|
||||||
$(fio02_SOURCES) $(fs01_SOURCES) $(fs02_SOURCES) \
|
$(fio02_SOURCES) $(fs01_SOURCES) $(fs02_SOURCES) \
|
||||||
$(fs03_SOURCES) $(glob01_SOURCES) $(nwad01_SOURCES) \
|
$(fs03_SOURCES) $(glob01_SOURCES) $(log01_SOURCES) \
|
||||||
$(nwif01_SOURCES) $(nwif02_SOURCES) $(pio01_SOURCES) \
|
$(nwad01_SOURCES) $(nwif01_SOURCES) $(nwif02_SOURCES) \
|
||||||
$(rwl01_SOURCES) $(sio01_SOURCES) $(sio02_SOURCES) \
|
$(pio01_SOURCES) $(rwl01_SOURCES) $(sio01_SOURCES) \
|
||||||
$(sio03_SOURCES) $(task01_SOURCES)
|
$(sio02_SOURCES) $(sio03_SOURCES) $(task01_SOURCES)
|
||||||
am__can_run_installinfo = \
|
am__can_run_installinfo = \
|
||||||
case $$AM_UPDATE_INFO_DIR in \
|
case $$AM_UPDATE_INFO_DIR in \
|
||||||
n|no|NO) false;; \
|
n|no|NO) false;; \
|
||||||
@ -457,6 +461,7 @@ fs01_SOURCES = fs01.c
|
|||||||
fs02_SOURCES = fs02.c
|
fs02_SOURCES = fs02.c
|
||||||
fs03_SOURCES = fs03.c
|
fs03_SOURCES = fs03.c
|
||||||
glob01_SOURCES = glob01.c
|
glob01_SOURCES = glob01.c
|
||||||
|
log01_SOURCES = log01.c
|
||||||
nwad01_SOURCES = nwad01.c
|
nwad01_SOURCES = nwad01.c
|
||||||
nwif01_SOURCES = nwif01.c
|
nwif01_SOURCES = nwif01.c
|
||||||
nwif02_SOURCES = nwif02.c
|
nwif02_SOURCES = nwif02.c
|
||||||
@ -581,6 +586,10 @@ glob01$(EXEEXT): $(glob01_OBJECTS) $(glob01_DEPENDENCIES) $(EXTRA_glob01_DEPENDE
|
|||||||
@rm -f glob01$(EXEEXT)
|
@rm -f glob01$(EXEEXT)
|
||||||
$(AM_V_CCLD)$(LINK) $(glob01_OBJECTS) $(glob01_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(glob01_OBJECTS) $(glob01_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
log01$(EXEEXT): $(log01_OBJECTS) $(log01_DEPENDENCIES) $(EXTRA_log01_DEPENDENCIES)
|
||||||
|
@rm -f log01$(EXEEXT)
|
||||||
|
$(AM_V_CCLD)$(LINK) $(log01_OBJECTS) $(log01_LDADD) $(LIBS)
|
||||||
|
|
||||||
nwad01$(EXEEXT): $(nwad01_OBJECTS) $(nwad01_DEPENDENCIES) $(EXTRA_nwad01_DEPENDENCIES)
|
nwad01$(EXEEXT): $(nwad01_OBJECTS) $(nwad01_DEPENDENCIES) $(EXTRA_nwad01_DEPENDENCIES)
|
||||||
@rm -f nwad01$(EXEEXT)
|
@rm -f nwad01$(EXEEXT)
|
||||||
$(AM_V_CCLD)$(LINK) $(nwad01_OBJECTS) $(nwad01_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(nwad01_OBJECTS) $(nwad01_LDADD) $(LIBS)
|
||||||
@ -631,6 +640,7 @@ distclean-compile:
|
|||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs02.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs02.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs03.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs03.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glob01.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glob01.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log01.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nwad01.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nwad01.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nwif01.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nwif01.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nwif02.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nwif02.Po@am__quote@
|
||||||
|
55
qse/samples/si/log01.c
Normal file
55
qse/samples/si/log01.c
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#include <qse/cmn/mem.h>
|
||||||
|
#include <qse/cmn/hwad.h>
|
||||||
|
#include <qse/si/log.h>
|
||||||
|
#include <qse/si/nwad.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void t1 (void)
|
||||||
|
{
|
||||||
|
qse_log_t* log;
|
||||||
|
qse_log_target_t t;
|
||||||
|
qse_int128_t q = 0x1234567890;
|
||||||
|
int i;
|
||||||
|
qse_nwad_t nwad;
|
||||||
|
|
||||||
|
t.file = QSE_T("/tmp/t3.log");
|
||||||
|
//qse_strtonwad ("127.0.0.1:560", &nwad);
|
||||||
|
qse_strtonwad ("@/dev/log", &nwad);
|
||||||
|
qse_nwadtoskad (&nwad, &t.syslog_remote);
|
||||||
|
|
||||||
|
log = qse_log_open (QSE_MMGR_GETDFL(), 0, QSE_T("t3"),
|
||||||
|
QSE_LOG_INCLUDE_PID | QSE_LOG_DEBUG | QSE_LOG_CONSOLE |
|
||||||
|
QSE_LOG_FILE | QSE_LOG_SYSLOG | QSE_LOG_SYSLOG_REMOTE, &t);
|
||||||
|
|
||||||
|
QSE_ASSERT (qse_log_getoption (log) == QSE_LOG_INCLUDE_PID);
|
||||||
|
QSE_ASSERT (qse_log_gettarget (log, QSE_NULL) == (QSE_LOG_CONSOLE | QSE_LOG_FILE | QSE_LOG_SYSLOG | QSE_LOG_SYSLOG_REMOTE));
|
||||||
|
|
||||||
|
for (i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (i == 4)
|
||||||
|
{
|
||||||
|
qse_log_target_t t2;
|
||||||
|
|
||||||
|
qse_log_gettarget (log, &t2);
|
||||||
|
qse_strtonwad ("127.0.0.1:560", &nwad);
|
||||||
|
qse_nwadtoskad (&nwad, &t2.syslog_remote);
|
||||||
|
qse_log_settarget (log, QSE_LOG_CONSOLE | QSE_LOG_FILE | QSE_LOG_SYSLOG_REMOTE, &t2);
|
||||||
|
|
||||||
|
qse_log_setoption (log, qse_log_getoption(log) | QSE_LOG_KEEP_FILE_OPEN);
|
||||||
|
|
||||||
|
QSE_ASSERT (qse_log_getoption (log) == (QSE_LOG_INCLUDE_PID | QSE_LOG_KEEP_FILE_OPEN));
|
||||||
|
QSE_ASSERT (qse_log_gettarget (log, QSE_NULL) == (QSE_LOG_CONSOLE | QSE_LOG_FILE | QSE_LOG_SYSLOG_REMOTE));
|
||||||
|
}
|
||||||
|
|
||||||
|
QSE_LOG4 (log, QSE_T("test"), QSE_LOG_DEBUG, QSE_T("XXXXXXXX %d %I128x %#0128I128b %l20d >>"), 10 * i , q, q, (long)45);
|
||||||
|
}
|
||||||
|
|
||||||
|
qse_log_close (log);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (int argc, char* argv[])
|
||||||
|
{
|
||||||
|
t1 ();
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user