some fixes in logging

This commit is contained in:
louis 2014-05-09 15:41:31 +02:00
parent ca71c83e5d
commit 9ebafce3fd
4 changed files with 80 additions and 14 deletions

View File

@ -7,6 +7,7 @@
IMAGELIB = imagemagick IMAGELIB = imagemagick
PLUGIN = scraper2vdr PLUGIN = scraper2vdr
HLIB = -L./lib -lhorchi
### The version number of this plugin (taken from the main source file): ### The version number of this plugin (taken from the main source file):
@ -35,7 +36,7 @@ APIVERSION = $(call PKGCFG,apiversion)
-include $(PLGCFG) -include $(PLGCFG)
LIBS = $(shell mysql_config --libs_r) -luuid LIBS = $(HLIB) $(shell mysql_config --libs_r) -luuid
### The name of the distribution archive: ### The name of the distribution archive:
@ -63,11 +64,14 @@ endif
### The object files (add further files here): ### The object files (add further files here):
OBJS = $(PLUGIN).o config.o setup.o update.o scrapmanager.o tvdbseries.o moviedbmovie.o tools.o lib/db.o lib/tabledef.o lib/common.o lib/config.o OBJS = $(PLUGIN).o config.o setup.o update.o scrapmanager.o tvdbseries.o moviedbmovie.o tools.o
### The main target: ### The main target:
all: $(SOFILE) i18n all: hlib $(SOFILE) i18n
hlib:
(cd lib && make -s lib)
### Implicit rules: ### Implicit rules:
@ -129,7 +133,8 @@ dist: $(I18Npo) clean
clean: clean:
@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ lib/*~ @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
(cd lib && make clean)
cppchk: cppchk:
cppcheck --template="{file}:{line}:{severity}:{message}" --quiet --force *.c *.h lib/*.c lib/*.h cppcheck --template="{file}:{line}:{severity}:{message}" --quiet --force *.c *.h lib/*.c lib/*.h

View File

@ -1,14 +1,75 @@
#
# Makefile
#
# See the README file for copyright information and how to reach the author.
#
BASELIBS = -lrt -lz -lmysqlclient -lcurl -luuid LIBTARGET = libhorchi
HLIB = -L. -lhorchi
DEMO = demo
TEST = tst
LIBOBJS = common.o curl.o imgtools.o config.o db.o tabledef.o dbdict.o
CC = g++
doCompile = $(CC) -c $(CFLAGS) $(DEFINES)
doLink = $(CC) $(LFLAGS)
doLib = ar -rs
BASELIBS = -lrt -lz -lmysqlclient -lcurl -luuid -lcrypto
BASELIBS += $(shell mysql_config --libs) BASELIBS += $(shell mysql_config --libs)
DEBUG = 1
ifdef DEBUG
CFLAGS += -ggdb -O0
endif
CFLAGS += -fPIC -Wreturn-type -Wall -Wno-parentheses -Wformat -pedantic -Wunused-variable -Wunused-label \
-Wunused-value -Wunused-function \
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
CFLAGS += $(shell mysql_config --include) CFLAGS += $(shell mysql_config --include)
all: DEFINES = -DPLGDIR='"."' -DUSEUUID -DUSEMD5
g++ -ggdb -DPLGDIR='"."' $(CFLAGS) test.c dbdict.c common.c config.c db.c tabledef.c $(BASELIBS) -o t
demo: demo.c all: lib $(TEST) $(DEMO)
g++ -ggdb -DUSEUUID -DPLGDIR='"."' $(CFLAGS) demo.c common.c db.c tabledef.c config.c $(BASELIBS) -o demo lib: $(LIBTARGET).a
$(LIBTARGET).a : $(LIBOBJS)
@echo Building Lib ...
$(doLib) $@ $(LIBOBJS)
tst: test.o
$(doLink) test.o $(HLIB) $(BASELIBS) -o $@
demo: demo.o
$(doLink) demo.o $(HLIB) $(BASELIBS) -o $@
clean: clean:
rm -f *.o *.a *~ core demo rm -f *.o *~ core $(TEST) $(DEMO) $(LIBTARGET).a
cppchk:
cppcheck --template="{file}:{line}:{severity}:{message}" --quiet --force *.c *.h
%.o: %.c
@echo Compile "$(*F)" ...
$(doCompile) $(*F).c -o $@
#--------------------------------------------------------
# dependencies
#--------------------------------------------------------
HEADER = db.h common.h config.h
common.o : common.c $(HEADER) common.h
curl.o : curl.c $(HEADER)
imgtools.o : imgtools.c $(HEADER) imgtools.h
config.o : config.c $(HEADER) config.h
db.o : db.c $(HEADER) db.h
tabledef.o : tabledef.c $(HEADER) tabledef.h
dbdict.o : dbdict.c $(HEADER) dbdict.h
demo.o : demo.c $(HEADER)
test.o : test.c $(HEADER)

View File

@ -455,9 +455,9 @@ class cDbStatements
void append(cDbStatement* s) { statements.push_back(s); } void append(cDbStatement* s) { statements.push_back(s); }
void remove(cDbStatement* s) { statements.remove(s); } void remove(cDbStatement* s) { statements.remove(s); }
void showStat() void showStat(const char* name)
{ {
tell(0, "Statement statistic of last %ld seconds:", statisticPeriod); tell(0, "Statement statistic of last %ld seconds from '%s':", time(0) - statisticPeriod, name);
for (std::list<cDbStatement*>::iterator it = statements.begin() ; it != statements.end(); ++it) for (std::list<cDbStatement*>::iterator it = statements.begin() ; it != statements.end(); ++it)
{ {
@ -756,7 +756,7 @@ class cDbConnection
int errorSql(cDbConnection* mysql, const char* prefix, MYSQL_STMT* stmt = 0, const char* stmtTxt = 0); int errorSql(cDbConnection* mysql, const char* prefix, MYSQL_STMT* stmt = 0, const char* stmtTxt = 0);
void showStat() { statements.showStat(); } void showStat(const char* name = "") { statements.showStat(name); }
static int init() static int init()
{ {

View File

@ -354,7 +354,7 @@ void cScrapManager::DumpMovies(void) {
} }
void cScrapManager::DumpRecordings(void) { void cScrapManager::DumpRecordings(void) {
tell(0, "%ld recordings in memory:", recordings.size()); tell(0, "%d recordings in memory:", (int)recordings.size());
for (map<sRecordingsKey, sEventsValue>::iterator it = recordings.begin(); it != recordings.end(); it++) { for (map<sRecordingsKey, sEventsValue>::iterator it = recordings.begin(); it != recordings.end(); it++) {
sRecordingsKey key = it->first; sRecordingsKey key = it->first;
sEventsValue val = it->second; sEventsValue val = it->second;