From fd5e4dca62a25361ef82f0bf407d8ac4edfdfce5 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sat, 4 Sep 2021 15:05:23 +0100 Subject: [PATCH] Log conversion --- GNUmakefile | 4 +- boxstack.cc | 56 ++++----- config.json.sample | 3 +- demuxer.cc | 31 +++-- demuxerts.cc | 46 ++++---- demuxervdr.cc | 12 +- i18n.cc | 1 - imageomx.cc | 3 +- inputcec.cc | 2 +- inputlinux.cc | 1 + log.h | 6 + main.cc | 29 +---- objects.mk | 2 +- oldlog.cc | 240 -------------------------------------- oldlog.h | 121 ------------------- osdopenvg.cc | 2 +- playerradiolive.cc | 50 ++++---- playerradiolive.h | 5 +- playerradiorec.cc | 44 +++---- playerradiorec.h | 4 +- recman.cc | 4 +- sleeptimer.cc | 8 +- sleeptimer.h | 4 +- stream.cc | 2 +- surface.cc | 1 - tbboxx.cc | 2 - tfeed.cc | 1 - vaudioselector.cc | 4 +- vchannelselect.cc | 2 - vconnect.cc | 20 ++-- vconnect.h | 4 +- vdr.h | 2 +- vepg.cc | 10 +- vepglistadvanced.cc | 26 +++-- vepgsettimer.cc | 22 ++-- vepgsettimer.h | 4 +- vopts.cc | 36 +++--- vpicturebanner.cc | 6 +- vradiorec.cc | 4 +- vrecording.cc | 8 +- vrecordinglist.cc | 16 +-- vrecordinglistadvanced.cc | 4 +- vrecordinglistclassic.cc | 4 +- vscreensaver.cc | 1 - vteletextview.cc | 9 +- vtimerlist.cc | 10 +- vvideorec.cc | 50 ++++---- vwelcome.cc | 2 +- wjpeg.cc | 1 - wjpegsimple.cc | 36 ++---- woptionbox.cc | 1 - woptionpane.cc | 4 +- wremoteconfig.cc | 1 - wselectlist.cc | 1 - wtabbar.cc | 3 +- 55 files changed, 301 insertions(+), 674 deletions(-) delete mode 100644 oldlog.cc delete mode 100644 oldlog.h diff --git a/GNUmakefile b/GNUmakefile index 1e8c818..45e607b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -104,8 +104,8 @@ endif -#CXXFLAGS_DEV = $(DEFINES) -DDEV -g -O0 -Wall -Wextra -Wshadow -Werror=return-type -Wmissing-format-attribute -Wdisabled-optimization -Wmissing-declarations -Wmissing-noreturn -Winit-self -Woverloaded-virtual -Wold-style-cast -Wconversion -std=c++14 $(CXXFLAGS_EXTRA) $(INCLUDES) -CXXFLAGS_DEV = $(DEFINES) -DDEV -g -O0 -std=c++14 $(CXXFLAGS_EXTRA) $(INCLUDES) +CXXFLAGS_DEV = $(DEFINES) -DDEV -g -O0 -Wall -Wextra -Wshadow -Werror=return-type -Wmissing-format-attribute -Wdisabled-optimization -Wmissing-declarations -Wmissing-noreturn -Winit-self -Woverloaded-virtual -Wold-style-cast -Wconversion -std=c++14 $(CXXFLAGS_EXTRA) $(INCLUDES) +#CXXFLAGS_DEV = $(DEFINES) -DDEV -g -O0 -std=c++14 $(CXXFLAGS_EXTRA) $(INCLUDES) CXXFLAGS_REL = $(DEFINES) -O3 -Wall -Werror -std=c++14 $(CXXFLAGS_EXTRA) $(INCLUDES) .PHONY: clean fresh all install strip diff --git a/boxstack.cc b/boxstack.cc index 4161cd5..248b17e 100644 --- a/boxstack.cc +++ b/boxstack.cc @@ -21,7 +21,9 @@ #include "messagequeue.h" #include "input.h" -#include "oldlog.h" +#include "log.h" + +static const char* TAG = "BoxStack"; BoxStack* BoxStack::instance = NULL; @@ -76,13 +78,13 @@ int BoxStack::addVideoDisplay(Boxx* box,VideoDisplay vd) int BoxStack::add(Boxx* v) { if (!initted) return 0; - Log::getInstance()->log("BoxStack", Log::DEBUG, "add called"); + LogNT::getInstance()->debug(TAG, "add called"); boxLock.lock(); - Log::getInstance()->log("BoxStack", Log::DEBUG, "Locked for add"); + LogNT::getInstance()->debug(TAG, "Locked for add"); if (numBoxes == 16) { //Error - Log::getInstance()->log("BoxStack", Log::ERR, "More than 16 boxes! Unlocked for add"); + LogNT::getInstance()->error(TAG, "More than 16 boxes! Unlocked for add"); boxLock.unlock(); return 0; } @@ -90,13 +92,13 @@ int BoxStack::add(Boxx* v) boxLock.unlock(); VideoDisplay vd; if (v->getVideoDisplay(vd)) { - Log::getInstance()->log("BoxStack", Log::DEBUG, "Add video display"); + LogNT::getInstance()->debug(TAG, "Add video display"); addVideoDisplay(v,vd); } - Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for add"); + LogNT::getInstance()->debug(TAG, "Unlocked for add"); return 1; } @@ -109,16 +111,16 @@ int BoxStack::remove(Boxx* toDelete) VideoDisplay *display = NULL; boxLock.lock(); - Log::getInstance()->log("BoxStack", Log::DEBUG, "Locked for remove"); + LogNT::getInstance()->debug(TAG, "Locked for remove"); if (numBoxes == 0) { boxLock.unlock(); - Log::getInstance()->log("BoxStack", Log::ERR, "Unlocked for remove numBoxes == 0"); + LogNT::getInstance()->error(TAG, "Unlocked for remove numBoxes == 0"); return 0; } -// Log::getInstance()->log("BoxStack", Log::DEBUG, "entering remove, numBoxes=%i", numBoxes); +// LogNT::getInstance()->debug(TAG, "entering remove, numBoxes={}", numBoxes); int i; @@ -132,7 +134,7 @@ int BoxStack::remove(Boxx* toDelete) // to be deleted box is more likely to be at the top for (i = numBoxes-1; i >= 0; i--) { -// Log::getInstance()->log("BoxStack", Log::DEBUG, "todel: %p, i=%i, boxes[i]=%p", toDelete, i, boxes[i]); +// LogNT::getInstance()->debug(TAG, "todel: {}, i={}, boxes[i]={}", (void*)toDelete, i, (void*)boxes[i]); if (boxes[i] == toDelete) break; } @@ -141,7 +143,7 @@ int BoxStack::remove(Boxx* toDelete) // not a Box we have! // FIXME boxLock.unlock(); - Log::getInstance()->log("BoxStack", Log::ERR, "Unlocked for remove - no boxx deleted"); + LogNT::getInstance()->error(TAG, "Unlocked for remove - no boxx deleted"); return 0; } } @@ -152,7 +154,7 @@ int BoxStack::remove(Boxx* toDelete) boxLock.lock(); - //Log::getInstance()->log("BoxStack", Log::DEBUG, "Starting repaintRevealed loop"); + //LogNT::getInstance()->debug(TAG, "Starting repaintRevealed loop"); RegionList rl; boxSplit(boxes[i]->area, i + 1, numBoxes, 1, rl); while(!rl.empty()) @@ -160,7 +162,7 @@ int BoxStack::remove(Boxx* toDelete) repaintRevealed(i, rl.front()); rl.pop_front(); } - //Log::getInstance()->log("BoxStack", Log::DEBUG, "Done repaintRevealed loop"); + //LogNT::getInstance()->debug(TAG, "Done repaintRevealed loop"); // Shift the boxes on top down one --numBoxes; @@ -180,18 +182,18 @@ int BoxStack::remove(Boxx* toDelete) if (!videoStack.empty()) display=&videoStack.top().second; } boxLock.unlock(); - Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for remove"); + LogNT::getInstance()->debug(TAG, "Unlocked for remove"); // Delete the box //AVO: do this delete outside the lock to allow for recursive calls within the destructor // as this box is not in the stack any more, there is no chance for a second delete - Log::getInstance()->log("BoxStack", Log::DEBUG, "remove: going to delete boxx %p, num %d", toDelete, numBoxes); + LogNT::getInstance()->debug(TAG, "remove: going to delete boxx {}, num {}", (void*)toDelete, numBoxes); delete toDelete; osd->doRender(); if (display) { - Log::getInstance()->log("BoxStack", Log::DEBUG, "setVideoDisplay %d %d %d %d %d %d", display->mode, display->fallbackMode, + LogNT::getInstance()->debug(TAG, "setVideoDisplay {} {} {} {} {} {}", display->mode, display->fallbackMode, display->x, display->y, display->width, display->height); Video::getInstance()->setVideoDisplay(*display); } @@ -214,10 +216,10 @@ void BoxStack::redrawAllBoxes() void BoxStack::update(Boxx* toUpdate, const Region* regionToUpdate) { -// Log::getInstance()->log("BoxStack", Log::DEBUG, "Update called"); +// LogNT::getInstance()->debug(TAG, "Update called"); if (!initted) return; // it is allowed to call this before init boxLock.lock(); -// Log::getInstance()->log("BoxStack", Log::DEBUG, "Locked for update"); +// LogNT::getInstance()->debug(TAG, "Locked for update"); // Get the z index of the box int z = 0; @@ -232,7 +234,7 @@ void BoxStack::update(Boxx* toUpdate, const Region* regionToUpdate) { // not a Box we have! boxLock.unlock(); - Log::getInstance()->log("BoxStack", Log::ERR, "Unlocked for update! box not inside boxstack"); + LogNT::getInstance()->error(TAG, "Unlocked for update! box not inside boxstack"); return; } } @@ -243,7 +245,7 @@ void BoxStack::update(Boxx* toUpdate, const Region* regionToUpdate) if (!toUpdate) { boxLock.unlock(); - Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for update, no box present"); + LogNT::getInstance()->debug(TAG, "Unlocked for update, no box present"); return ; } @@ -276,7 +278,7 @@ void BoxStack::update(Boxx* toUpdate, const Region* regionToUpdate) } boxLock.unlock(); -// Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for update"); +// LogNT::getInstance()->debug(TAG, "Unlocked for update"); } void BoxStack::repaintRevealed(int x, Region r) @@ -469,7 +471,7 @@ void BoxStack::removeAllExceptWallpaper() } else { - Log::getInstance()->log("BoxStack", Log::ERR, "Can this actually happen? Why?"); + LogNT::getInstance()->error(TAG, "Can this actually happen? Why?"); toDel = NULL; } @@ -481,7 +483,7 @@ void BoxStack::removeAllExceptWallpaper() boxLock.unlock(); //AVO: do the delete outside the lock to allow for recursive deletes - Log::getInstance()->log("BoxStack", Log::DEBUG, "removeall: going to delete boxx %p, num=%d", toDel, numBoxes); + LogNT::getInstance()->debug(TAG, "removeall: going to delete boxx {}, num={}", (void*)toDel, numBoxes); if (display) Video::getInstance()->setVideoDisplay(*display); if (toDel) delete toDel; @@ -504,7 +506,7 @@ int BoxStack::handleCommand(int command) for (i=numBoxes-1; i>=0; i--) { - // Log::getInstance()->log("BoxStack", Log::DEBUG, "Giving command to i=%i", i); + // LogNT::getInstance()->debug(TAG, "Giving command to i={}", i); retVal = boxes[i]->handleCommand(command); if (retVal == 1) { @@ -520,7 +522,7 @@ int BoxStack::handleCommand(int command) } else if (retVal == 4) { -// Log::getInstance()->log("BoxStack", Log::DEBUG, "Return 4: i=%i, boxes[i]=%p", i, boxes[i]); +// LogNT::getInstance()->debug(TAG, "Return 4: i={}, boxes[i]={}", i, (void*)boxes[i]); remove(boxes[i]); retVal2 = 1; break; @@ -544,7 +546,7 @@ void BoxStack::processMessage(Message* m) { if (boxes[i] == m->to) { - Log::getInstance()->log("BoxStack", Log::DEBUG, "sending message from box %p to box %p %lu", m->from, m->to, m->message); + LogNT::getInstance()->debug(TAG, "sending message from box {} to box {} {}", (void*)m->from, (void*)m->to, m->message); boxes[i]->processMessage(m); return; } @@ -560,7 +562,7 @@ void BoxStack::processMessage(Message* m) return; } - Log::getInstance()->log("BoxStack", Log::DEBUG, "it's for meeee!"); + LogNT::getInstance()->debug(TAG, "it's for meeee!"); switch(m->message) { diff --git a/config.json.sample b/config.json.sample index 0400f10..3bae319 100644 --- a/config.json.sample +++ b/config.json.sample @@ -8,13 +8,12 @@ { "main": { - "debug": false, "daemonize": true }, "log": { - "enabled": true, + "enabled": false, "filename": "stdout", "level": "debug" }, diff --git a/demuxer.cc b/demuxer.cc index a91d84a..075a8b9 100644 --- a/demuxer.cc +++ b/demuxer.cc @@ -23,7 +23,7 @@ #include "callback.h" #include "dvbsubtitles.h" -#include "oldlog.h" +#include "log.h" #include #include @@ -42,6 +42,8 @@ #define SEEK_THRESHOLD 150000 // About 1.5 seconds +static const char* TAG = "Demuxer"; + // Statics const int Demuxer::FrameRates[9] = { 0, 23, 24, 25, 29, 30, 50, 59, 60 }; Demuxer* Demuxer::instance = NULL; @@ -415,7 +417,7 @@ UINT PESPacket::countPictureHeaders(bool h264, struct PictCountInfo& pinfo) cons pos+=nalu.getPos(); } if (testpattern==DEMUXER_H264_CODED_SLICE_IDR || testpattern==DEMUXER_H264_CODED_SLICE_NON_IDR ) { - /* Log::getInstance()->log("Demuxer", Log::ERR, + /* LogNT::getInstance()->error(TAG, "Has slice %d %d %d %d %d",pinfo.hasaccessunit, pinfo.hassps,pinfo.frame_mbs_only_flag,pinfo.separate_color_plane_flag, pinfo.log2_max_frame_num);*/ if (pinfo.hasaccessunit && pinfo.hassps) { @@ -566,8 +568,7 @@ int Demuxer::init(Callback* tcallback, DrainTarget* audio, DrainTarget* video, D !audiostream.init(audio, demuxMemoryA) || !teletextstream.init(teletext, demuxMemoryT)) { - Log::getInstance()->log("Demuxer", Log::CRIT, - "Failed to initialize demuxer"); + LogNT::getInstance()->crit(TAG, "Failed to initialize demuxer"); shutdown(); return 0; } @@ -587,7 +588,7 @@ int Demuxer::init(Callback* tcallback, DrainTarget* audio, DrainTarget* video, D void Demuxer::reset() { - Log::getInstance()->log("Demuxer", Log::DEBUG, "Reset called"); + LogNT::getInstance()->debug(TAG, "Reset called"); flush(); video_current = audio_current = teletext_current = subtitle_current = -1; horizontal_size = vertical_size = 0; @@ -627,7 +628,7 @@ int Demuxer::shutdown() void Demuxer::flush() { - Log::getInstance()->log("Demuxer", Log::DEBUG, "Flush called"); + LogNT::getInstance()->debug(TAG, "Flush called"); videostream.flush(); audiostream.flush(); @@ -669,8 +670,7 @@ void Demuxer::setAspectRatio(enum AspectRatio ar, int taspectx, int taspecty) { if ((aspect_ratio != ar) || (parx != taspectx) || (pary != taspecty) ) { - Log::getInstance()->log("Demux", Log::DEBUG, - "Aspect ratio difference signalled"); + LogNT::getInstance()->debug(TAG, "Aspect ratio difference signalled"); if (++arcnt > 3) // avoid changing aspect ratio if glitch in signal { arcnt = 0; @@ -810,8 +810,7 @@ void Demuxer::parsePacketDetails(PESPacket& packet) video_pts_seek + (1LL<<33) - audio_pts < SEEK_THRESHOLD) )) { aud_seeking = 0; - Log::getInstance()->log("Demuxer", Log::DEBUG, - "Leaving audio sync: Audio PTS = %llu", audio_pts); + LogNT::getInstance()->debug(TAG, "Leaving audio sync: Audio PTS = {}", audio_pts); } } } @@ -864,7 +863,7 @@ void Demuxer::parsePacketDetails(PESPacket& packet) video_pts_seek + (1LL<<33) - audio_pts < SEEK_THRESHOLD) )) { aud_seeking = 0; - Log::getInstance()->log("Demuxer", Log::DEBUG, "Leaving audio sync: Audio PTS = %llu", audio_pts); + LogNT::getInstance()->debug(TAG, "Leaving audio sync: Audio PTS = {}", audio_pts); } } break; @@ -919,7 +918,7 @@ void Demuxer::parsePacketDetails(PESPacket& packet) int commona; int commonb; - // Log::getInstance()->log("Demuxer", Log::DEBUG, "PAR test1 %d %d %d %d ", aspectx,aspecty,commona,commonb); + // LogNT::getInstance()->debug(TAG, "PAR test1 {} {} {} {}", aspectx, aspecty, commona, commonb); commona=aspectx; commonb=aspecty; @@ -930,7 +929,7 @@ void Demuxer::parsePacketDetails(PESPacket& packet) } aspectx=aspectx/commona; aspecty=aspecty/commona; - //Log::getInstance()->log("Demuxer", Log::DEBUG, "PAR test2 %d %d %d %d %d %d %d", aspectx,aspecty,aspectDARx,aspectDARy,horizontal_size,vertical_size,commona); + //LogNT::getInstance()->debug(TAG, "PAR test2 {} {} {} {} {} {} {}", aspectx,aspecty,aspectDARx,aspectDARy,horizontal_size,vertical_size,commona); setAspectRatio(aspect,aspectx,aspecty); frame_rate = packet[pos+3] & 0x0f; @@ -1127,10 +1126,8 @@ void Demuxer::parsePacketDetails(PESPacket& packet) { vid_seeking = 0; video_pts_seek = video_pts; - Log::getInstance()->log("Demuxer", Log::DEBUG, - "Entering audio sync: Video PTS = %llu", video_pts); - Log::getInstance()->log("Demuxer", Log::DEBUG, - "Entering audio sync: Audio PTS = %llu", audio_pts); + LogNT::getInstance()->debug(TAG, "Entering audio sync: Video PTS = {}", video_pts); + LogNT::getInstance()->debug(TAG, "Entering audio sync: Audio PTS = {}", audio_pts); } return; } diff --git a/demuxerts.cc b/demuxerts.cc index 4394c49..3aff0c1 100644 --- a/demuxerts.cc +++ b/demuxerts.cc @@ -18,7 +18,7 @@ */ #include "demuxerts.h" -#include "oldlog.h" +#include "log.h" #include "video.h" #include "vdr.h" #include "audio.h" @@ -176,7 +176,7 @@ int DemuxerTS::findPTS(UCHAR* buf, int len, ULLONG* dest) int pmtpid = (*(curbuf+11)<< 8) | *(curbuf+12); if ((pmtpid >> 13) != 0x07) { - Log::getInstance()->log("findPTS", Log::DEBUG, "PMTPID=%02x %02x TRAILING 111 not set but %x", *(curbuf+11),*(curbuf+12), (pmtpid >> 13)); + LogNT::getInstance()->debug("findPTS", "PMTPID={:#x} {:#x} TRAILING 111 not set but {:#x}", *(curbuf+11),*(curbuf+12), (pmtpid >> 13)); } else { @@ -197,7 +197,7 @@ int DemuxerTS::findPTS(UCHAR* buf, int len, ULLONG* dest) p += 2; //skip ES length if ((foundpid >> 13) != 0x07) { - Log::getInstance()->log("findPTS", Log::DEBUG, "FOUNDPID=%02x %02x TRAILING 111 not set but %x", *(buf+p),*(buf+p+1), (foundpid >> 13)); + LogNT::getInstance()->debug("findPTS", "FOUNDPID={:#x} {:#x} TRAILING 111 not set but {:#x}", *(buf+p),*(buf+p+1), (foundpid >> 13)); } else { @@ -235,14 +235,14 @@ void DemuxerTS::setFrameNum(ULONG frame) frameCounting = true; frameNumber = frame; framereserve=0; - Log::getInstance()->log("DemuxerTS", Log::DEBUG, "setFrameNum %d", frame); + LogNT::getInstance()->debug("DemuxerTS", "setFrameNum {}", frame); } void DemuxerTS::setPacketNum(ULONG npacket) { packetCounting = true; packetNumber = npacket; - Log::getInstance()->log("DemuxerTS", Log::DEBUG, "setPacketNum %d", npacket); + LogNT::getInstance()->debug("DemuxerTS", "setPacketNum {}", npacket); } int DemuxerTS::put(UCHAR* buf, int len) @@ -270,7 +270,7 @@ int DemuxerTS::put(UCHAR* buf, int len) else { // Packet not terminated. Find another candidate, and shift store if (!misaligned_mess) { - Log::getInstance()->log("TS Demuxer", Log::ERR, "TS Misaligned!A"); + LogNT::getInstance()->error("TS Demuxer", "TS Misaligned!A"); misaligned_mess=true; // do not alarm more than once } int search = 1; @@ -293,7 +293,7 @@ int DemuxerTS::put(UCHAR* buf, int len) while (len > 0 && *buf != TS_SIG) { if (!misaligned_mess) { - Log::getInstance()->log("TS Demuxer", Log::ERR, "TS Misaligned!B"); + LogNT::getInstance()->error("TS Demuxer", "TS Misaligned!B"); misaligned_mess=true; // do not alarm more than once } buf++; ret++; len--; @@ -358,7 +358,7 @@ int DemuxerTS::processTS(UCHAR* buf) int pmtpid = (*(buf+11)<< 8) | *(buf+12); if ((pmtpid >> 13) != 0x07) { - Log::getInstance()->log("ProcessTS", Log::DEBUG, "PMTPID=%02x %02x TRAILING 111 not set but %x", *(buf+11),*(buf+12), (pmtpid >> 13)); + LogNT::getInstance()->debug("ProcessTS", "PMTPID={:#x} {:#x} TRAILING 111 not set but {:#x}", *(buf+11),*(buf+12), (pmtpid >> 13)); } else { @@ -396,7 +396,7 @@ int DemuxerTS::processTS(UCHAR* buf) p += 2; //skip ES length if ((foundpid >> 13) != 0x07) { - Log::getInstance()->log("ProcessTS", Log::DEBUG, "FOUNDPID=%02x %02x TRAILING 111 not set but %x", *(buf+p),*(buf+p+1), (foundpid >> 13)); + LogNT::getInstance()->debug("ProcessTS", "FOUNDPID={:#x} {:#x} TRAILING 111 not set but {:#x}", *(buf+p),*(buf+p+1), (foundpid >> 13)); } else { @@ -404,7 +404,7 @@ int DemuxerTS::processTS(UCHAR* buf) bool notfound=false; bool nolang=true; int pos=0; - // Log::getInstance()->log("ProcessTS", Log::DEBUG, "FOUNDPID is %x %x", foundpid,streamtype); + // LogNT::getInstance()->debug("ProcessTS", "FOUNDPID is {:#x} {:#x}", foundpid,streamtype); switch (streamtype) { case 0x1B: //MPEG 4 for future use @@ -418,7 +418,7 @@ int DemuxerTS::processTS(UCHAR* buf) if (streamtype==0x1b) h264=true; else h264=false; - // Log::getInstance()->log("ProcessTS", Log::DEBUG, "Set video PID to %x", foundpid); + // LogNT::getInstance()->debug("ProcessTS", "Set video PID to {:#x}", foundpid); }break; case 0x0F: //AAC ADTS packaging case 0x11: // LATM packaging @@ -438,7 +438,7 @@ int DemuxerTS::processTS(UCHAR* buf) newapid.desc[2]=buf[p+pos+4]; newapid.desc[3]=0; nolang=false; - // Log::getInstance()->log("ProcessTS", Log::DEBUG, "FOUNDLANG is %s", newapid.desc); + // LogNT::getInstance()->debug("ProcessTS", "FOUNDLANG is {}", newapid.desc); } break; }; @@ -477,7 +477,7 @@ int DemuxerTS::processTS(UCHAR* buf) newapid.desc[3]=0; newapid.data1=(buf[p+pos+5]<<8) |(buf[p+pos+6]); newapid.data2=(buf[p+pos+7]<<8) |(buf[p+pos+8]); - // Log::getInstance()->log("ProcessTS", Log::DEBUG, "FOUNDSUB is %s", newapid.desc); + // LogNT::getInstance()->debug("ProcessTS", "FOUNDSUB is {}", newapid.desc); notfound=false; nolang=false; } break; @@ -487,7 +487,7 @@ int DemuxerTS::processTS(UCHAR* buf) newapid.desc[2]=buf[p+pos+4]; newapid.desc[3]=0; nolang=false; - // Log::getInstance()->log("ProcessTS", Log::DEBUG, "FOUNDLANG is %s", newapid.desc); + // LogNT::getInstance()->debug("ProcessTS", "FOUNDLANG is {}", newapid.desc); } break; case 0x56: { type=3; @@ -732,7 +732,7 @@ int DemuxerTS::processTS(UCHAR* buf) if (pid == subID && subActive && subPacket.getLength() == subLength) { parsePacketDetails(subPacket); -//Log::getInstance()->log("DEMUXERTS", Log::DEBUG, "SUBMITTING A SUBTITLE PACKET %d %x", subLength, subPacket.getSubstream()); +//LogNT::getInstance()->debug("DEMUXERTS", "SUBMITTING A SUBTITLE PACKET {} {:#x}", subLength, subPacket.getSubstream()); submitPacket(subPacket); subActive = false; } @@ -756,7 +756,7 @@ ULONG DemuxerTS::getFrameNumFromPTS(ULLONG pts) while (iter != pts_map.end()) { ++total; - //Log::getInstance()->log("DemuxerTS", Log::DEBUG, "getFrameNumfromPTS pts1 %lld pts2 %lld", pts, iter->pts); + //LogNT::getInstance()->debug("DemuxerTS", "getFrameNumfromPTS pts1 {} pts2 {}", pts, iter->pts); if (PTSDifference(iter->pts, pts) < PTS_ALLOWANCE) { difference = 0; @@ -780,7 +780,7 @@ ULONG DemuxerTS::getFrameNumFromPTS(ULLONG pts) } pts_map_mutex.unlock(); - //Log::getInstance()->log("DemuxerTS", Log::DEBUG, "getFrameNumfromPTS pts %lld deleted %d difference %lld", pts, total,difference); + //LogNT::getInstance()->debug("DemuxerTS", "getFrameNumfromPTS pts {} deleted {} difference {}", pts, total,difference); if (difference == (1LL<<33)) return 0; // We cannot make sense of the pts @@ -887,13 +887,13 @@ bool DemuxerTS::scanForVideo(UCHAR* buf, UINT len, bool &ish264) int pmtpid = (*(curbuf+11)<< 8) | *(curbuf+12); if ((pmtpid >> 13) != 0x07) { - Log::getInstance()->log("DemuxerTS", Log::DEBUG, "PMTPID=%02x %02x TRAILING 111 not set but %x", *(curbuf+11),*(curbuf+12), (pmtpid >> 13)); + LogNT::getInstance()->debug("DemuxerTS", "PMTPID={:#x} {:#x} TRAILING 111 not set but {:#x}", *(curbuf+11),*(curbuf+12), (pmtpid >> 13)); } else { pmtpid = pmtpid & 0x1FFF; //clear upper 3 bits pmtpidy = pmtpid; - Log::getInstance()->log("DemuxerTS", Log::DEBUG, "PMT pid%02x",pmtpid ); + LogNT::getInstance()->debug("DemuxerTS", "PMT pid {:#x}", pmtpid); } } else if (pid == pmtpidy) { //PMT @@ -909,21 +909,21 @@ bool DemuxerTS::scanForVideo(UCHAR* buf, UINT len, bool &ish264) p += 2; //skip ES length if ((foundpid >> 13) != 0x07) { - Log::getInstance()->log("DemuxerTS", Log::DEBUG, "FOUNDPID=%02x %02x TRAILING 111 not set but %x", *(buf+p),*(buf+p+1), (foundpid >> 13)); + LogNT::getInstance()->debug("DemuxerTS", "FOUNDPID={:#x} {:#x} TRAILING 111 not set but {:#x}", *(buf+p),*(buf+p+1), (foundpid >> 13)); } else { foundpid = foundpid & 0x1FFF; //clear upper 3 bits // int pos=0; UNUSED? - Log::getInstance()->log("DemuxerTS", Log::DEBUG, "Pid found %02x type %02x",foundpid ,streamtype); + LogNT::getInstance()->debug("DemuxerTS", "Pid found {:#x} type {:#x}",foundpid ,streamtype); if (streamtype==1 || streamtype ==2) { ish264=false; - Log::getInstance()->log("DemuxerTS", Log::DEBUG, "Found Mpeg2 Video"); + LogNT::getInstance()->debug("DemuxerTS", "Found Mpeg2 Video"); return true; } if (streamtype==0x1b) { ish264=true; - Log::getInstance()->log("DemuxerTS", Log::DEBUG, "Found h264 Video"); + LogNT::getInstance()->debug("DemuxerTS", "Found h264 Video"); return true; } } diff --git a/demuxervdr.cc b/demuxervdr.cc index 0e12eff..2479972 100644 --- a/demuxervdr.cc +++ b/demuxervdr.cc @@ -20,7 +20,7 @@ #include "demuxervdr.h" #include "video.h" #include "dvbsubtitles.h" -#include "oldlog.h" +#include "log.h" #ifndef WIN32 #include @@ -33,6 +33,8 @@ #define PTS_JUMP_MARGIN 10000 #define PTS_ALLOWANCE 90000 +static const char* TAG = "DemuxerVDR"; + // TODO: PTS class to handle wrapping arithmetic & comparisons? static ULLONG PTSDistance(ULLONG pts1, ULLONG pts2) { @@ -135,14 +137,14 @@ void DemuxerVDR::setFrameNum(ULONG frame) { frameCounting = true; frameNumber = frame; - Log::getInstance()->log("Demuxer", Log::DEBUG, "setFrameNum %d", frame); + LogNT::getInstance()->debug(TAG, "setFrameNum {}", frame); } void DemuxerVDR::setPacketNum(ULONG npacket) { packetCounting = true; packetNumber = npacket; - Log::getInstance()->log("Demuxer", Log::DEBUG, "setPacketNum %d", npacket); + LogNT::getInstance()->debug(TAG, "setPacketNum {}", npacket); } int DemuxerVDR::put(UCHAR* buf, int len) @@ -370,7 +372,7 @@ void DemuxerVDR::parseVDRPacketDetails() me.pts = packet.getPTS(); me.frame = frame_num; pts_map_mutex.unlock(); -Log::getInstance()->log("Demuxer", Log::DEBUG, "+* PTS INIT *+ %llu %u", me.pts, me.frame); +LogNT::getInstance()->debug(TAG, "+* PTS INIT *+ {} {}", me.pts, me.frame); pts_map_mutex.lock(); pts_map.push_front(me); } @@ -383,7 +385,7 @@ Log::getInstance()->log("Demuxer", Log::DEBUG, "+* PTS INIT *+ %llu %u", me.pts, if (PTSDistance(pts_expected, packet.getPTS()) > PTS_JUMP_MARGIN) // PTS jump! { -Log::getInstance()->log("Demuxer", Log::DEBUG, "+* PTS JUMP *+ %llu %u", packet.getPTS(), frame_num); +LogNT::getInstance()->debug(TAG, "+* PTS JUMP *+ {} {}", packet.getPTS(), frame_num); me.pts = packet.getPTS(); me.frame = frame_num; pts_map_mutex.lock(); diff --git a/i18n.cc b/i18n.cc index 100aaba..cd4c92c 100644 --- a/i18n.cc +++ b/i18n.cc @@ -29,7 +29,6 @@ #endif*/ #include "vdr.h" -#include "oldlog.h" I18n::trans_table I18n::Translations; diff --git a/imageomx.cc b/imageomx.cc index 18ee566..84bab65 100644 --- a/imageomx.cc +++ b/imageomx.cc @@ -18,8 +18,9 @@ */ #include + +#include "log.h" #include "videoomx.h" -#include "oldlog.h" #include "vdr.h" #include "woptionpane.h" #include "util.h" diff --git a/inputcec.cc b/inputcec.cc index 8a8f15e..f313023 100644 --- a/inputcec.cc +++ b/inputcec.cc @@ -24,7 +24,7 @@ using namespace CEC; #include -#include "oldlog.h" +#include "log.h" #include "vdr.h" #include "woptionpane.h" #include "inputcec.h" diff --git a/inputlinux.cc b/inputlinux.cc index 676a4d7..67c9d0f 100644 --- a/inputlinux.cc +++ b/inputlinux.cc @@ -18,6 +18,7 @@ */ #include +#include #include #include #include diff --git a/log.h b/log.h index 814314d..b21e26d 100644 --- a/log.h +++ b/log.h @@ -34,6 +34,12 @@ #include "defines.h" +class ExternLogger +{ + public: + virtual bool LogExtern(const char* message)=0; +}; + class LogNT { public: diff --git a/main.cc b/main.cc index 4cc91a8..65b126b 100644 --- a/main.cc +++ b/main.cc @@ -44,7 +44,6 @@ #include "config.h" #include "log.h" -#include "oldlog.h" #include "util.h" #include "control.h" @@ -63,7 +62,6 @@ void threadSignalReceiverFunction(); [[ noreturn ]] void shutdown(int code); Config* config; -Log* logger; LogNT* loggerNT; Control* control; @@ -116,24 +114,6 @@ int main(int argc, char** argv) } // Start Log -------------------------------------------------------------------------------------------------- - logger = new Log(); - if (!logger) - { - printf("Failed to create Log object\n"); - shutdown(1); - } - - bool debugEnabled; - config->getBool("main", "debug", debugEnabled); - if (!logger->init(Log::DEBUG, "dummy", debugEnabled ? 1 : 0)) // NCONFIG x2 - { - printf("Could not initialise log object. Aborting.\n"); - shutdown(1); - } - - logger->log("Main", Log::INFO, "Old log starting up..."); - - loggerNT = new LogNT(); if (!loggerNT) @@ -144,6 +124,8 @@ int main(int argc, char** argv) std::string logFileName("stdout"); config->getString("log", "filename", logFileName); + bool debugEnabled; + config->getBool("main", "debug", debugEnabled); if (!loggerNT->init(logFileName, debugEnabled ? 1 : 0)) // NCONFIG x2 { printf("Could not initialise log object. Aborting.\n"); @@ -291,11 +273,12 @@ void threadSignalReceiverFunction() close(fdtty); #endif - if (logger) + if (loggerNT) { loggerNT->info(TAG, "Log module shutting down... bye!\n\n"); - logger->shutdown(); - delete logger; +#warning loggerNT has no shutdown + //loggerNT->shutdown(); + delete loggerNT; } if (config) diff --git a/objects.mk b/objects.mk index 05d8e96..fb4bbf1 100644 --- a/objects.mk +++ b/objects.mk @@ -1,5 +1,5 @@ OBJ_COMMON = util.o control.o thread.o timers.o i18n.o udp4.o udp6.o vdpc.o tcp.o \ - message.o messagequeue.o wol.o audio.o video.o oldlog.o \ + message.o messagequeue.o wol.o audio.o video.o \ vdr.o recman.o recording.o recinfo.o channel.o rectimer.o event.o \ directory.o mark.o option.o vfeed.o afeed.o \ demuxer.o demuxervdr.o demuxerts.o stream.o osd.o surface.o \ diff --git a/oldlog.cc b/oldlog.cc deleted file mode 100644 index 558c1ef..0000000 --- a/oldlog.cc +++ /dev/null @@ -1,240 +0,0 @@ -/* - Copyright 2004-2005 Chris Tallon - Copyright 2003-2004 University Of Bradford - - This file is part of VOMP. - - VOMP 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 2 of the License, or - (at your option) any later version. - - VOMP 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 VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include - -#ifndef WIN32 -#include -#include -#endif - -#include "vdr.h" - - -#include "oldlog.h" - - -#ifdef __ANDROID__ -#include -#endif - -Log* Log::instance = NULL; - -Log::Log() -{ - if (instance) return; - instance = this; - logfile = NULL; - initted = 0; - logLevel = 0; - extlog = NULL; -} - -Log::~Log() -{ - instance = NULL; -} - -Log* Log::getInstance() -{ - return instance; -} - -void Log::upLogLevel() -{ - if (logLevel == Log::DEBUG) - { - log("Log", logLevel, "Log level is at its highest already"); - return; - } - - logLevel++; - log("Log", logLevel, "Log level is now %i", logLevel); -} - -void Log::downLogLevel() -{ - if (logLevel == Log::CRAZY) - { - log("Log", logLevel, "Log level is at its lowest already"); - return; - } - - logLevel--; - log("Log", logLevel, "Log level is now %i", logLevel); -} - -int Log::init(int startLogLevel, const char* fileName, int tenabled) -{ - (void)fileName; - - initted = 1; - logLevel = startLogLevel; - enabled = tenabled; - - // FIXME fix this with NCONFIG -// logfile = fopen(fileName, "a"); -// logfile = fopen(stdout, "a"); - logfile = stdout; -// logfile = fopen("/log", "a"); - - if (logfile) return 1; - else return 0; -} - -int Log::shutdown() -{ - if (!initted) return 1; - if (enabled && (logfile != stdout)) fclose(logfile); - return 1; -} - -int Log::log(const char *fromModule, int level,const char* message, ...) -{ - if (!instance || !logfile) return 0; - - if (!enabled && !extlog) return 1; - if (level > logLevel) return 1; - - char buffer[151]; - int spaceLeft = 150; - -#ifndef _MSC_VER - struct timeval tv; - gettimeofday(&tv, NULL); - struct tm tms; - LOCALTIME_R(&tv.tv_sec, &tms); - spaceLeft -= strftime(buffer, spaceLeft, "%H:%M:%S.", &tms); - spaceLeft -= SNPRINTF(&buffer[150-spaceLeft], spaceLeft, "%06lu ", static_cast(tv.tv_usec)); -#else - struct _timeb tb; - _ftime(&tb); - struct tm* tms = localtime(&tb.time); - spaceLeft -= strftime(buffer, spaceLeft, "%H:%M:%S.", tms); - spaceLeft -= SNPRINTF(&buffer[150-spaceLeft], spaceLeft, "%06lu ", (unsigned long)tb.millitm); -#endif - - char levelString[10]; - if (level == CRAZY) strcpy(levelString, "[CRAZY] "); - if (level == EMERG) strcpy(levelString, "[EMERG] "); - if (level == ALERT) strcpy(levelString, "[ALERT] "); - if (level == CRIT) strcpy(levelString, "[CRIT] "); - if (level == ERR) strcpy(levelString, "[ERR] "); - if (level == WARN) strcpy(levelString, "[WARN] "); - if (level == NOTICE) strcpy(levelString, "[notice]"); - if (level == INFO) strcpy(levelString, "[info] "); - if (level == DEBUG) strcpy(levelString, "[debug] "); - -#ifndef WIN32 - spaceLeft -= SNPRINTF(&buffer[150-spaceLeft], spaceLeft, "%s %lu %li %s - ", levelString, pthread_self(), syscall(SYS_gettid), fromModule); -#else - spaceLeft -= SNPRINTF(&buffer[150-spaceLeft], spaceLeft, "%s %s - ", levelString, fromModule); -#endif - - va_list ap; - va_start(ap, message); - spaceLeft = VSNPRINTF(&buffer[150-spaceLeft], spaceLeft, message, ap); - va_end(ap); - - int messageLength = strlen(buffer); - if (messageLength < 150) - { - buffer[messageLength] = '\n'; - buffer[messageLength+1] = '\0'; - } - else - { - buffer[149] = '\n'; - buffer[150] = '\0'; - } - - int success = 1; - if (enabled) - { -#ifndef __ANDROID__ - success = fputs(buffer, logfile); - fflush(NULL); -#else - int and_level=0; - switch (level) { - case CRAZY: - case ALERT: - case EMERG : - case CRIT:{ - and_level=ANDROID_LOG_FATAL; - } break; - case ERR: { - and_level=ANDROID_LOG_ERROR; - } break; - case WARN: { - and_level=ANDROID_LOG_WARN; - } break; - case NOTICE: - case INFO: { - and_level=ANDROID_LOG_INFO; - } break; - case DEBUG :{ - and_level=ANDROID_LOG_DEBUG; - } break; - }; - __android_log_vprint(and_level, fromModule, - message, ap); -#endif - } - - if (extlog) extlog->LogExtern(buffer); //Replacement for network logging - - - if (success != EOF) - return 1; - else - return 0; - -} - -void Log::logLongString(const char *fromModule, int level,const char *message) -{ - int string_size=strlen(message); - char buffer[100]; - const char * pointer=message; - for (int str_written=0; str_written -#ifndef WIN32 - #include - #include -#else - #include -#endif - -#include -#include -#include -#include -#include "defines.h" - - -class ExternLogger { -public: - virtual bool LogExtern(const char* message)=0; -}; - - -class Log -{ - public: - Log(); - ~Log(); - static Log* getInstance(); - - int init(int defaultLevel,const char* fileName, int enabled); - int shutdown(); - - [[deprecated]] - int log(const char *fromModule, int level,const char *message, ...); - - [[deprecated]] - void logLongString(const char *fromModule, int level,const char *message); - int status(); - void upLogLevel(); - void downLogLevel(); - [[deprecated]] - void setExternLogger(ExternLogger* log); - [[deprecated]] - void unsetExternLogger() { - extlog=NULL; - } - - - - const static int CRAZY = 0; // mad crazy things that should never happen - const static int EMERG = 1; // human assist required NOW - const static int ALERT = 2; // system unusable, but happy to sit there - const static int CRIT = 3; // still working, but maybe about to die - const static int ERR = 4; // that response is not even listed... - const static int WARN = 5; // this could be a bad thing. still running tho - const static int NOTICE = 6; // significant good thing - const static int INFO = 7; // verbose good thing - const static int DEBUG = 8; // debug-level messages - - private: - static Log* instance; - int initted; - int logLevel; - int enabled; - - FILE *logfile; - - ExternLogger* extlog; - - -}; - -#endif - -/* - -Documentation -------------- - -This class is intended to be instatiated once by the core. -For a one off use: - -Log::getInstance()->log("", Log::, ""); - -Or, a pointer can be stored and used: - -Log *myptr = Log::getInstance(); - -myptr->log("", Log::, ""); -myptr->log("", Log::, ""); - -Level usages are above. - -The message parameter in the log function can be used in the same way as printf, eg. - -myptr->log("", Log::, "Success: %s %i", stringpointer, integer); - -*/ diff --git a/osdopenvg.cc b/osdopenvg.cc index 6fa2778..9e60663 100644 --- a/osdopenvg.cc +++ b/osdopenvg.cc @@ -23,7 +23,7 @@ #include #include -#include "oldlog.h" +#include "log.h" #include "videoomx.h" #include "surface.h" #include "message.h" diff --git a/playerradiolive.cc b/playerradiolive.cc index 1f74515..f0cf33c 100644 --- a/playerradiolive.cc +++ b/playerradiolive.cc @@ -24,7 +24,7 @@ #include #include "defines.h" -#include "oldlog.h" +#include "log.h" #include "audio.h" #include "demuxerts.h" #include "vdr.h" @@ -36,13 +36,15 @@ #include "playerradiolive.h" +static const char* TAG = "PlayerRadioLive"; + // ----------------------------------- Called from outside, one offs or info funcs PlayerRadioLive::PlayerRadioLive(MessageQueue* tmessageQueue, void* tmessageReceiver, ChannelList* tchanList) : messageQueue(tmessageQueue), messageReceiver(tmessageReceiver), afeed(this), chanList(tchanList) { audio = Audio::getInstance(); - logger = Log::getInstance(); + logger = LogNT::getInstance(); vdr = VDR::getInstance(); Video::getInstance()->turnVideoOff(); @@ -62,7 +64,7 @@ int PlayerRadioLive::init() if (!demuxer->init(this, audio, NULL, NULL, 0, 200000, 0)) { - logger->log("PlayerRadioLive", Log::ERR, "Demuxer failed to init"); + logger->error(TAG, "Demuxer failed to init"); shutdown(); return 0; } @@ -78,7 +80,7 @@ int PlayerRadioLive::shutdown() if (!initted) return 0; if (state != S_STOP) // FIXME check when this is called and how. This is not thread-sync bullet proof as-is. { - logger->log("PlayerRadioLive", Log::DEBUG, "state is not stop, calling"); + logger->debug(TAG, "state is not stop, calling"); stop(); } initted = false; @@ -143,18 +145,18 @@ void PlayerRadioLive::go(ULONG index) void PlayerRadioLive::setChannel(ULONG index) { - logger->log("PlayerRadioLive", Log::DEBUG, "setChannel"); + logger->debug(TAG, "setChannel"); struct PLInstruction i; i.instruction = I_SETCHANNEL; i.channelIndex = index; instructions.push(i); - logger->log("PlayerRadioLive", Log::DEBUG, "posted setChannel instruction, now %i in queue", instructions.size()); + logger->debug(TAG, "posted setChannel instruction, now {} in queue", instructions.size()); playerThreadCond.notify_one(); } void PlayerRadioLive::stop() { - logger->log("PlayerRadioLive", Log::DEBUG, "stop"); + logger->debug(TAG, "stop"); playerThreadMutex.lock(); struct PLInstruction i; i.instruction = I_STOP; @@ -162,7 +164,7 @@ void PlayerRadioLive::stop() playerThreadCond.notify_one(); playerThreadMutex.unlock(); playerThread.join(); - logger->log("PlayerRadioLive", Log::DEBUG, "stop successful"); + logger->debug(TAG, "stop successful"); } // ----------------------------------- Callback @@ -204,7 +206,7 @@ void PlayerRadioLive::streamReceive(ULONG flag, void* data, ULONG len) { // Too many chunks in streamChunks, drop this chunk free(data); - logger->log("PlayerRadioLive", Log::WARN, "Dropped chunk"); + logger->warn(TAG, "Dropped chunk"); } } @@ -212,7 +214,7 @@ void PlayerRadioLive::clearStreamChunks() { while(streamChunks.size()) { - logger->log("PlayerRadioLive", Log::DEBUG, "Dropping chunk from old stream"); + logger->debug(TAG, "Dropping chunk from old stream"); struct StreamChunk s = streamChunks.front(); streamChunks.pop(); free(s.data); @@ -223,15 +225,15 @@ void PlayerRadioLive::chunkToDemuxer() { StreamChunk s = streamChunks.front(); streamChunks.pop(); - //logger->log("PlayerRadioLive", Log::DEBUG, "About to call demuxer with %p %lu", s.data, s.len); + //logger->debug(TAG, "About to call demuxer with {} {}", (void*)s.data, s.len); /*int a =*/ demuxer->put(static_cast(s.data), s.len); - //logger->log("PlayerRadioLive", Log::DEBUG, "put %i to demuxer", a); + //logger->debug(TAG, "put {} to demuxer", a); free(s.data); } void PlayerRadioLive::switchState(UCHAR newState) { - logger->log("PlayerRadioLive", Log::DEBUG, "Switch from state %u to state %u", state, newState); + logger->debug(TAG, "Switch from state {} to state {}", state, newState); switch(state) { @@ -258,7 +260,7 @@ void PlayerRadioLive::switchState(UCHAR newState) } default: { - logger->log("PlayerRadioLive", Log::EMERG, "Thread called state %u to state %u which is not supported", state, newState); + logger->crit(TAG, "Thread called state {} to state {} which is not supported", state, newState); abort(); break; } @@ -303,7 +305,7 @@ void PlayerRadioLive::switchState(UCHAR newState) } default: { - logger->log("PlayerRadioLive", Log::EMERG, "Thread called state %u to state %u which is not supported", state, newState); + logger->crit(TAG, "Thread called state {} to state {} which is not supported", state, newState); abort(); break; } @@ -342,7 +344,7 @@ void PlayerRadioLive::switchState(UCHAR newState) } default: { - logger->log("PlayerRadioLive", Log::EMERG, "Thread called state %u to state %u which is not supported", state, newState); + logger->crit(TAG, "Thread called state {} to state {} which is not supported", state, newState); abort(); break; } @@ -400,7 +402,7 @@ void PlayerRadioLive::threadMethod() { if (instructions.size() > 1) { - logger->log("PlayerRadioLive", Log::DEBUG, "Should optimise"); + logger->debug(TAG, "Should optimise"); optimizeInstructionQueue(); } @@ -409,7 +411,7 @@ void PlayerRadioLive::threadMethod() if (i.instruction == I_SETCHANNEL) { - logger->log("PlayerRadioLive", Log::DEBUG, "start new stream"); + logger->debug(TAG, "start new stream"); switchState(S_PREBUFFERING); @@ -429,7 +431,7 @@ void PlayerRadioLive::threadMethod() { demuxer->setAID(chan->apids[j].pid, 0, chan->apids[j].type, true); audio->setStreamType(Audio::MPEG2_PES); - logger->log("PlayerRadioLive", Log::DEBUG, "Demuxer pids: %u %u %u", chan->vpid, chan->apids[j].pid, chan->apids[j].type); + logger->debug(TAG, "Demuxer pids: {} {} {}", chan->vpid, chan->apids[j].pid, chan->apids[j].type); found = true; } j++; @@ -447,7 +449,7 @@ void PlayerRadioLive::threadMethod() { demuxer->setAID(chan->dpids[j].pid, 1, chan->dpids[j].type, true); audio->setStreamType(Audio::MPEG2_PES); - logger->log("PlayerRadioLive", Log::DEBUG, "Demuxer pids: %u %u (ac3) %u", chan->vpid, chan->dpids[j].pid, chan->dpids[j].type); + logger->debug(TAG, "Demuxer pids: {} {} (ac3) {}", chan->vpid, chan->dpids[j].pid, chan->dpids[j].type); found=true; } j++; @@ -455,7 +457,7 @@ void PlayerRadioLive::threadMethod() } else { - logger->log("PlayerRadioLive", Log::WARN, "Demuxer no pids!"); + logger->warn(TAG, "Demuxer no pids!"); } } @@ -473,7 +475,7 @@ void PlayerRadioLive::threadMethod() } else if (i.instruction == I_STOP) { - logger->log("PlayerRadioLive", Log::DEBUG, "Stopping"); + logger->debug(TAG, "Stopping"); switchState(S_STOP); checkError(); return; @@ -489,7 +491,7 @@ void PlayerRadioLive::threadMethod() ++preBufferCount; ULONG percentDone = (preBufferCount * 100) / preBufferAmount; - logger->log("PlayerRadioLive", Log::DEBUG, "Prebuffering %lu%%", percentDone); + logger->debug(TAG, "Prebuffering {}%", percentDone); Message* m = new Message(); m->from = this; @@ -513,5 +515,5 @@ void PlayerRadioLive::threadMethod() ul.unlock(); } - logger->log("PlayerRadioLive", Log::DEBUG, "End of thread"); + logger->debug(TAG, "End of thread"); } diff --git a/playerradiolive.h b/playerradiolive.h index 6bf4fea..6d38e42 100644 --- a/playerradiolive.h +++ b/playerradiolive.h @@ -26,6 +26,7 @@ #include +#include "log.h" #include "playerlive.h" #include "callback.h" #include "defines.h" @@ -34,7 +35,7 @@ class MessageQueue; class Audio; -class Log; +class LogNT; class DemuxerTS; class PlayerRadioLive : public PlayerLive, public Callback, public StreamReceiver @@ -76,7 +77,7 @@ class PlayerRadioLive : public PlayerLive, public Callback, public StreamReceive private: MessageQueue* messageQueue; void* messageReceiver; - Log* logger; + LogNT* logger; Audio* audio; DemuxerTS* demuxer; VDR* vdr; diff --git a/playerradiorec.cc b/playerradiorec.cc index 1ae8a9b..905f8aa 100644 --- a/playerradiorec.cc +++ b/playerradiorec.cc @@ -23,7 +23,7 @@ #endif #include -#include "oldlog.h" +#include "log.h" #include "audio.h" #include "video.h" #include "demuxervdr.h" @@ -36,13 +36,15 @@ #include "playerradiorec.h" +static const char* TAG = "PlayerRadioRec"; + // ----------------------------------- Called from outside, one offs or info funcs PlayerRadioRec::PlayerRadioRec(MessageQueue* tmessageQueue, void* tmessageReceiver) : messageQueue(tmessageQueue), messageReceiver(tmessageReceiver), afeed(this) { audio = Audio::getInstance(); - logger = Log::getInstance(); + logger = LogNT::getInstance(); vdr = VDR::getInstance(); Video::getInstance()->turnVideoOff(); } @@ -64,7 +66,7 @@ bool PlayerRadioRec::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRe if (!demuxer->init(this, audio, NULL, NULL, 0, 40000, 0)) { - logger->log("PlayerRadioRec", Log::ERR, "Demuxer failed to init"); + logger->error(TAG, "Demuxer failed to init"); shutdown(); return false; } @@ -74,7 +76,7 @@ bool PlayerRadioRec::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRe lengthBytes = tlengthBytes; lengthFrames = tlengthFrames; - logger->log("PlayerRadioRec", Log::DEBUG, "PlayerRadioRec has received length bytes of %llu", lengthBytes); + logger->debug(TAG, "PlayerRadioRec has received length bytes of {}", lengthBytes); UINT thisRead = 0; int success; @@ -82,7 +84,7 @@ bool PlayerRadioRec::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRe UCHAR* buffer = vdr->getBlock(0, 10000, &thisRead); if (!buffer) { - logger->log("PlayerRadioRec", Log::ERR, "Failed to get start block"); + logger->error(TAG, "Failed to get start block"); shutdown(); if (!vdr->isConnected()) doConnectionLost(); return false; @@ -91,7 +93,7 @@ bool PlayerRadioRec::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRe success = demuxer->findPTS(buffer, thisRead, &startPTS); if (!success) { - logger->log("PlayerRadioRec", Log::ERR, "Failed to get start PTS"); + logger->error(TAG, "Failed to get start PTS"); free(buffer); shutdown(); return false; @@ -101,7 +103,7 @@ bool PlayerRadioRec::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRe if (!setLengthSeconds()) { - logger->log("PlayerRadioRec", Log::ERR, "Failed to setLengthSeconds"); + logger->error(TAG, "Failed to setLengthSeconds"); shutdown(); return false; } @@ -118,7 +120,7 @@ bool PlayerRadioRec::setLengthSeconds() UCHAR* buffer = vdr->getBlock(lengthBytes - 10000, 10000, &thisRead); if (!buffer) { - logger->log("PlayerRadioRec", Log::ERR, "Failed to get end block"); + logger->error(TAG, "Failed to get end block"); if (!vdr->isConnected()) doConnectionLost(); return false; } @@ -127,7 +129,7 @@ bool PlayerRadioRec::setLengthSeconds() free(buffer); if (!success) { - logger->log("PlayerRadioRec", Log::ERR, "Failed to get end PTS"); + logger->error(TAG, "Failed to get end PTS"); return false; } @@ -208,7 +210,7 @@ void PlayerRadioRec::stop() if (!initted) return; if (state == S_STOP) return; stateLock.lock(); - logger->log("PlayerRadioRec", Log::DEBUG, "Stop called lock"); + logger->debug(TAG, "Stop called lock"); switchState(S_STOP); stateLock.unlock(); } @@ -229,7 +231,7 @@ void PlayerRadioRec::pause() void PlayerRadioRec::jumpToPercent(double percent) { stateLock.lock(); - logger->log("PlayerRadioRec", Log::DEBUG, "JUMP TO %i%%", percent); + logger->debug(TAG, "JUMP TO {}%", percent); ULONG newFrame = static_cast(percent * lengthFrames / 100); switchState(S_JUMP, newFrame); stateLock.unlock(); @@ -238,7 +240,7 @@ void PlayerRadioRec::jumpToPercent(double percent) void PlayerRadioRec::skipForward(UINT seconds) { std::lock_guard lg(stateLock); - logger->log("PlayerRadioRec", Log::DEBUG, "SKIP FORWARD %i SECONDS", seconds); + logger->debug(TAG, "SKIP FORWARD {} SECONDS", seconds); ULONG currentSeconds = getCurrentSeconds(); ULONG currentFrame = demuxer->getPacketNum(); @@ -253,7 +255,7 @@ void PlayerRadioRec::skipForward(UINT seconds) void PlayerRadioRec::skipBackward(UINT seconds) { std::lock_guard lg(stateLock); - logger->log("PlayerRadioRec", Log::DEBUG, "SKIP BACKWARD %i SECONDS", seconds); + logger->debug(TAG, "SKIP BACKWARD {} SECONDS", seconds); ULONG currentSeconds = getCurrentSeconds(); ULONG currentFrame = demuxer->getPacketNum(); @@ -275,7 +277,7 @@ void PlayerRadioRec::switchState(UCHAR toState, ULONG jumpToFrame) { if (!initted) return; - logger->log("PlayerRadioRec", Log::DEBUG, "Switch state from %u to %u", state, toState); + logger->debug(TAG, "Switch state from {} to {}", state, toState); switch(state) // current state selector { @@ -410,7 +412,7 @@ void PlayerRadioRec::restartAtFrame(ULONG newFrame) void PlayerRadioRec::doConnectionLost() { - logger->log("PlayerRadioRec", Log::DEBUG, "Connection lost, sending message"); + logger->debug(TAG, "Connection lost, sending message"); Message* m = new Message(); m->to = messageReceiver; m->from = this; @@ -439,7 +441,7 @@ void PlayerRadioRec::threadMethod() feedPosition = vdr->positionFromFrameNumber(currentFrameNumber); if (!vdr->isConnected()) { doConnectionLost(); return; } - logger->log("PlayerRadioRec", Log::DEBUG, "startFeedPlay: wantedFrame %i goto %llu", currentFrameNumber, feedPosition); + logger->debug(TAG, "startFeedPlay: wantedFrame {} goto {}", currentFrameNumber, feedPosition); Buffer threadBuffer; @@ -459,12 +461,12 @@ void PlayerRadioRec::threadMethod() { lengthBytes = vdr->rescanRecording(&lengthFrames); if (!vdr->isConnected()) { doConnectionLost(); return; } - logger->log("PlayerRadioRec", Log::DEBUG, "Rescanned and reset length: %llu", lengthBytes); + logger->debug(TAG, "Rescanned and reset length: {}", lengthBytes); lastRescan = time(NULL); if (!setLengthSeconds()) { - logger->log("PlayerRadioRec", Log::ERR, "Failed to setLengthSeconds in thread"); + logger->error(TAG, "Failed to setLengthSeconds in thread"); return; } } @@ -501,7 +503,7 @@ void PlayerRadioRec::threadMethod() { int a_stream = demuxer->scan(threadBuffer.ucharp(), thisRead); demuxer->setAudioStream(a_stream); - logger->log("PlayerRadioRec", Log::DEBUG, "Startup Audio stream chosen %x", a_stream); + logger->debug(TAG, "Startup Audio stream chosen {:#x}", a_stream); startup = false; } @@ -529,7 +531,7 @@ void PlayerRadioRec::threadMethod() } // end of recording - logger->log("PlayerRadioRec", Log::DEBUG, "Recording playback ends"); + logger->debug(TAG, "Recording playback ends"); if (threadReqQuit) return; @@ -539,6 +541,6 @@ void PlayerRadioRec::threadMethod() m->from = this; m->message = Message::PLAYER_EVENT; m->parameter = PlayerRadioRec::STOP_PLAYBACK; - logger->log("PlayerRadioRec", Log::DEBUG, "Posting message to %p...", messageQueue); + logger->debug(TAG, "Posting message to {}...", (void*)messageQueue); messageQueue->postMessage(m); } diff --git a/playerradiorec.h b/playerradiorec.h index 585a7a1..460290f 100644 --- a/playerradiorec.h +++ b/playerradiorec.h @@ -28,7 +28,7 @@ #include "callback.h" #include "afeed.h" -class Log; +class LogNT; class Audio; class Video; class Demuxer; @@ -88,7 +88,7 @@ class PlayerRadioRec : public Callback MessageQueue* messageQueue; void* messageReceiver; - Log* logger; + LogNT* logger; Audio* audio; Demuxer* demuxer; VDR* vdr; diff --git a/recman.cc b/recman.cc index 32036fc..1fbe3ef 100644 --- a/recman.cc +++ b/recman.cc @@ -20,7 +20,7 @@ #include "recman.h" #include "vdr.h" -#include "oldlog.h" +#include "log.h" RecMan::RecMan() { @@ -261,6 +261,6 @@ void RecMan::toggleSortOrder() void RecMan::sort() { - Log::getInstance()->log("RecMan", Log::DEBUG, "Sort"); + LogNT::getInstance()->debug("RecMan", "Sort"); rootDir->sort(chronoSortOrder); } diff --git a/sleeptimer.cc b/sleeptimer.cc index 240eca6..c75dbfd 100644 --- a/sleeptimer.cc +++ b/sleeptimer.cc @@ -19,7 +19,7 @@ */ #include "defines.h" -#include "oldlog.h" +#include "log.h" #include "input.h" #include "wsymbol.h" #include "colour.h" @@ -34,7 +34,7 @@ SleepTimer::SleepTimer() { - logger = Log::getInstance(); + logger = LogNT::getInstance(); boxstack = BoxStack::getInstance(); timers = Timers::getInstance(); } @@ -134,7 +134,7 @@ void SleepTimer::timercall(int clientReference) { if (state == 0) // inactive { - logger->log("SleepTimer", Log::ERR, "Received timercall when state 0"); + logger->error("SleepTimer", "Received timercall when state 0"); } else if (state == 1 || state == 2) // counting (either with or without modify display showing) { @@ -188,7 +188,7 @@ void SleepTimer::timercall(int clientReference) } else if (state == 4) // not counting, off dialogue showing { - logger->log("SleepTimer", Log::ERR, "Received timercall when state 4"); + logger->error("SleepTimer", "Received timercall when state 4"); } } } diff --git a/sleeptimer.h b/sleeptimer.h index f548545..db3a197 100644 --- a/sleeptimer.h +++ b/sleeptimer.h @@ -27,7 +27,7 @@ #include "wsymbol.h" #include "timers.h" -class Log; +class LogNT; class BoxStack; class VSleepTimer; class VCountdown; @@ -41,7 +41,7 @@ class SleepTimer : public TimerReceiver void shutdown(); private: - Log* logger{}; + LogNT* logger{}; BoxStack* boxstack{}; Timers* timers{}; diff --git a/stream.cc b/stream.cc index ba6903e..14319bc 100644 --- a/stream.cc +++ b/stream.cc @@ -21,7 +21,7 @@ #include #include -#include "oldlog.h" +//#include "oldlog.h" #include "stream.h" Stream::~Stream() diff --git a/surface.cc b/surface.cc index 73b74ac..85697c7 100644 --- a/surface.cc +++ b/surface.cc @@ -20,7 +20,6 @@ #include #include #include "osd.h" -#include "oldlog.h" #include "video.h" #include "teletxt/txtfont.h" diff --git a/tbboxx.cc b/tbboxx.cc index b453286..857388d 100644 --- a/tbboxx.cc +++ b/tbboxx.cc @@ -20,8 +20,6 @@ #include "tbboxx.h" -#include "oldlog.h" - TBBoxx::TBBoxx() { titleBarOn = 0; diff --git a/tfeed.cc b/tfeed.cc index ce5bdc3..f342f4b 100644 --- a/tfeed.cc +++ b/tfeed.cc @@ -16,7 +16,6 @@ along with VOMP. If not, see . */ -#include "oldlog.h" #include "demuxer.h" #include "callback.h" #include "util.h" diff --git a/vaudioselector.cc b/vaudioselector.cc index a52663a..ea6bcac 100644 --- a/vaudioselector.cc +++ b/vaudioselector.cc @@ -30,7 +30,7 @@ #include "message.h" #include "messagequeue.h" #include "recinfo.h" -#include "oldlog.h" +#include "log.h" #include "channel.h" #include "vaudioselector.h" @@ -40,7 +40,7 @@ VAudioSelector::VAudioSelector(void* tparent, bool* availableMpegAudioChannels, int currentSubtitleChannel, int currentSubtitleType, RecInfo* recInfo) : parent(tparent), liveMode(false) { - Log::getInstance()->log("VAS", Log::DEBUG, "%i", currentAudioChannel); + LogNT::getInstance()->debug("VAudioSelector", "{}", currentAudioChannel); int i; diff --git a/vchannelselect.cc b/vchannelselect.cc index 02fb88e..8614136 100644 --- a/vchannelselect.cc +++ b/vchannelselect.cc @@ -17,12 +17,10 @@ along with VOMP. If not, see . */ - #include "input.h" #include "message.h" #include "boxstack.h" #include "colour.h" -#include "oldlog.h" #include "vdr.h" #include "messagequeue.h" diff --git a/vconnect.cc b/vconnect.cc index eb49266..e4e0caa 100644 --- a/vconnect.cc +++ b/vconnect.cc @@ -25,7 +25,7 @@ #include "i18n.h" #include "boxstack.h" #include "message.h" -#include "oldlog.h" +#include "log.h" #include "vdr.h" #include "wol.h" #include "vserverselect.h" @@ -34,11 +34,13 @@ #include "vconnect.h" +static const char* TAG = "VConnect"; + VConnect::VConnect() { boxstack = BoxStack::getInstance(); vdr = VDR::getInstance(); - logger = Log::getInstance(); + logger = LogNT::getInstance(); setSize(400, 200); createBuffer(); @@ -64,7 +66,7 @@ VConnect::~VConnect() void VConnect::draw() { VInfo::draw(); - logger->log("VConnect", Log::DEBUG, "Draw done"); + logger->debug(TAG, "Draw done"); } int VConnect::handleCommand(int /* command */) @@ -97,7 +99,7 @@ void VConnect::stop() void VConnect::threadMethod() { - logger->log("VConnect", Log::DEBUG, "start threadMethod"); + logger->debug(TAG, "start threadMethod"); ULONG delay = 0; int success; @@ -109,7 +111,7 @@ void VConnect::threadMethod() if (!vdpc.init()) { - logger->log("VConnect", Log::CRIT, "Failed to init VDPC"); + logger->crit(TAG, "Failed to init VDPC"); return; } @@ -130,7 +132,7 @@ void VConnect::threadMethod() } for (ULONG i = 0; i < vdpc.numServers(); i++) - logger->log("VConnect", Log::INFO, "Found server: %i %s %s %u", vdpc[i].ipVersion, vdpc[i].ip.c_str(), vdpc[i].name.c_str(), vdpc[i].port, vdpc[i].version); + logger->info(TAG, "Found server: {} {} {} {}", vdpc[i].ipVersion, vdpc[i].ip.c_str(), vdpc[i].name.c_str(), vdpc[i].port, vdpc[i].version); if (vdpc.numServers() == 1) { @@ -152,7 +154,7 @@ void VConnect::threadMethod() if (threadReqQuit) return; - logger->log("VConnect", Log::NOTICE, "Connecting to server at %s %u", vdpc[selectedServer].ip.c_str(), vdpc[selectedServer].port); + logger->info(TAG, "Connecting to server at {} {}", vdpc[selectedServer].ip.c_str(), vdpc[selectedServer].port); Wol::getInstance()->setWakeUpIP(vdpc[selectedServer].ip.c_str()); vdr->setServerIP(vdpc[selectedServer].ip.c_str()); vdr->setServerPort(vdpc[selectedServer].port); @@ -167,7 +169,7 @@ void VConnect::threadMethod() if (success) { - logger->log("VConnect", Log::DEBUG, "Connected ok, doing login"); + logger->debug(TAG, "Connected ok, doing login"); unsigned int version_server_min, version_server_max, version_client; int subtitles; success = vdr->doLogin(&version_server_min, &version_server_max, &version_client, Control::getInstance()->getASLList(), subtitles); @@ -199,7 +201,7 @@ void VConnect::threadMethod() if (threadReqQuit) return; } while(!success); - logger->log("VConnect", Log::INFO, "Send VDR connected message"); + logger->info(TAG, "Send VDR connected message"); Message* m = new Message(); // Must be done after this thread ends m->from = this; m->p_to = Message::CONTROL; diff --git a/vconnect.h b/vconnect.h index 2558029..32970b7 100644 --- a/vconnect.h +++ b/vconnect.h @@ -27,7 +27,7 @@ #include "vinfo.h" #include "vdpc.h" -class Log; +class LogNT; class BoxStack; class Message; @@ -45,7 +45,7 @@ class VConnect : public VInfo private: BoxStack* boxstack; - Log* logger; + LogNT* logger; VDPC vdpc; VDR* vdr; diff --git a/vdr.h b/vdr.h index 1d9c941..363edc1 100644 --- a/vdr.h +++ b/vdr.h @@ -33,6 +33,7 @@ #include #include "defines.h" +#include "log.h" #include "rectimer.h" #include "mark.h" #ifdef VOMP_MEDIAPLAYER @@ -40,7 +41,6 @@ #endif #include "eventdispatcher.h" #include "i18n.h" -#include "oldlog.h" #include "control.h" #include "tcp.h" diff --git a/vepg.cc b/vepg.cc index 4bf7c8d..d6440eb 100644 --- a/vepg.cc +++ b/vepg.cc @@ -42,10 +42,12 @@ #include "boxstack.h" #include "channel.h" #include "i18n.h" -#include "oldlog.h" +#include "log.h" #include "vepg.h" +static const char* TAG = "VEpg"; + VEpg* VEpg::instance = NULL; VEpg::VEpg(void* tparent, UINT tcurrentChannelIndex, ChannelList* tchanList) @@ -362,12 +364,12 @@ int VEpg::handleCommand(int command) } case Input::DOWN: { // cursor down the channel list - Log::getInstance()->log("VEPG", Log::DEBUG, "Down start"); + LogNT::getInstance()->debug(TAG, "Down start"); chanListbox.down(); drawData(); boxstack->update(this); - Log::getInstance()->log("VEPG", Log::DEBUG, "Down end"); + LogNT::getInstance()->debug(TAG, "Down end"); return 2; } @@ -421,7 +423,7 @@ int VEpg::handleCommand(int command) case Input::RECORD: { if (!chanList) return 2; - Log::getInstance()->log("VEPG", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s", thisEvent.id, thisEvent.time, thisEvent.duration, thisEvent.title); + LogNT::getInstance()->debug(TAG, "ID {} TIME {} DURATION {} TITLE {}", thisEvent.id, thisEvent.time, thisEvent.duration, thisEvent.title); VEpgSetTimer* vs = new VEpgSetTimer(&thisEvent, (*chanList)[chanListbox.getCurrentOption()]); vs->draw(); boxstack->add(vs); diff --git a/vepglistadvanced.cc b/vepglistadvanced.cc index 70b9505..a5dc8ef 100644 --- a/vepglistadvanced.cc +++ b/vepglistadvanced.cc @@ -28,7 +28,7 @@ #include "video.h" #include "i18n.h" #include "messagequeue.h" -#include "oldlog.h" +#include "log.h" #include "movieinfo.h" #include "seriesinfo.h" #include "event.h" @@ -40,6 +40,8 @@ #include "vepglistadvanced.h" +static const char* TAG = "VEpgListAdvanced"; + VEpgListAdvanced::VEpgListAdvanced(VVideoLiveTV* tvideolive, ChannelList* tchanList, ULONG initialChannelNumber) { channelNumber = initialChannelNumber; @@ -219,7 +221,7 @@ void VEpgListAdvanced::doBlue() void VEpgListAdvanced::doNext() { - Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doNext"); + LogNT::getInstance()->debug(TAG, "doNext"); ULONG slCurrentOption = reinterpret_cast(sl.getCurrentOptionData()); if (mode != OneChannel) @@ -240,7 +242,7 @@ void VEpgListAdvanced::doNext() void VEpgListAdvanced::doNow() { - Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doNow"); + LogNT::getInstance()->debug(TAG, "doNow"); ULONG slCurrentOption = reinterpret_cast(sl.getCurrentOptionData()); if (mode != OneChannel) @@ -261,7 +263,7 @@ void VEpgListAdvanced::doNow() void VEpgListAdvanced::doProgramm() { - Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doProgram"); + LogNT::getInstance()->debug(TAG, "doProgram"); mode = OneChannel; ULONG slCurrentOption = reinterpret_cast(sl.getCurrentOptionData()); Channel* chan = (*chanList)[slCurrentOption]; @@ -287,7 +289,7 @@ void VEpgListAdvanced::doSwitch() channelNumber = chan->number; } - Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "doSwitch %d", channelNumber); + LogNT::getInstance()->debug(TAG, "doSwitch {}", channelNumber); Message* m = new Message(); // Must be done after this view deleted m->from = this; m->to = videolive; @@ -310,7 +312,7 @@ void VEpgListAdvanced::doRecord() if (current) { - Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "Found the option you pointed at. %s %d", current->title, current->id); + LogNT::getInstance()->debug(TAG, "Found the option you pointed at. {} {}", current->title, current->id); unsigned int chanlistsize = chanList->size(); Channel* chan; UINT listIndex; @@ -322,7 +324,7 @@ void VEpgListAdvanced::doRecord() if (chan->number == channel) break; } - Log::getInstance()->log("VEpgSummary", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s", + LogNT::getInstance()->debug(TAG, "ID {} TIME {} DURATION {} TITLE {}", current->id, current->time, current->duration, current->title); VEpgSetTimer* vs = new VEpgSetTimer(current, chan); vs->draw(); @@ -462,7 +464,7 @@ void VEpgListAdvanced::updateEpgDataChannel() time_t now; time(&now); eventLista[0] = VDR::getInstance()->getChannelSchedule(channelNumber, now, 24 * 60 * 60 * 30); // one month - Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "Eventlist %x %d", eventLista[0], channelNumber); + LogNT::getInstance()->debug(TAG, "Eventlist {:#x} {}", (void*)eventLista[0], channelNumber); } void VEpgListAdvanced::drawData(bool doIndexPop) @@ -508,7 +510,7 @@ void VEpgListAdvanced::drawDataChannel(bool doIndexPop) strftime(tempB, 300, "- %H:%M ", &btime); int check = SNPRINTF(tempC, 300, "\t %s\n \t \t%s%s", currentEvent->title.c_str(), tempA, tempB); - if ((check < 0) || (check > 299)) Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "String too big"); + if ((check < 0) || (check > 299)) LogNT::getInstance()->debug(TAG, "String too big"); // New TVMedia stuff TVMediaInfo* info = new TVMediaInfo(); @@ -579,7 +581,7 @@ void VEpgListAdvanced::drawDataNowNext(bool next, bool doIndexPop) strftime(tempB, 300, "- %H:%M ", &btime); int check = SNPRINTF(tempC, 300, "%s\n%s\t %s%s", currentEvent->title.c_str(), chan->name, tempA, tempB); - if ((check < 0) || (check > 299)) Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "String too big"); + if ((check < 0) || (check > 299)) LogNT::getInstance()->debug(TAG, "String too big"); } else { @@ -882,7 +884,7 @@ int VEpgListAdvanced::handleCommand(int command) if (current) { - Log::getInstance()->log("VEventListAdvanced", Log::DEBUG, "Found the option you pointed at. %s %d", current->title.c_str(), current->id); + LogNT::getInstance()->debug(TAG, "Found the option you pointed at. {} {}", current->title.c_str(), current->id); unsigned int chanlistsize = chanList->size(); Channel* chan; UINT listIndex; @@ -917,7 +919,7 @@ int VEpgListAdvanced::handleCommand(int command) void VEpgListAdvanced::processMessage(Message* m) { - Log::getInstance()->log("VEpgListAdvanced", Log::DEBUG, "Got message value %lu", m->message); + LogNT::getInstance()->debug(TAG, "Got message value {}", m->message); if (m->message == Message::MOUSE_MOVE) { diff --git a/vepgsettimer.cc b/vepgsettimer.cc index 3c0241d..a82f6e4 100644 --- a/vepgsettimer.cc +++ b/vepgsettimer.cc @@ -23,7 +23,7 @@ #include "channel.h" #include "boxstack.h" #include "vdr.h" -#include "oldlog.h" +#include "log.h" #include "vinfo.h" #include "message.h" #include "control.h" @@ -34,11 +34,13 @@ #include "vepgsettimer.h" +static const char* TAG = "VEPGST"; + VEpgSetTimer::VEpgSetTimer(Event* tevent, Channel* tchannel) { boxstack = BoxStack::getInstance(); vdr = VDR::getInstance(); - logger = Log::getInstance(); + logger = LogNT::getInstance(); event = tevent; channel = tchannel; @@ -70,10 +72,10 @@ VEpgSetTimer::VEpgSetTimer(Event* tevent, Channel* tchannel) buttonYes.setActive(1); selectedOption = YES; - logger->log("VEPGST", Log::DEBUG, "Title: %s", event->title); - logger->log("VEPGST", Log::DEBUG, "Time: %lu", event->time); - logger->log("VEPGST", Log::DEBUG, "Duration: %lu", event->duration); - logger->log("VEPGST", Log::DEBUG, "Channel: %i", channel->number); + logger->debug(TAG, "Title: {}", event->title); + logger->debug(TAG, "Time: {}", event->time); + logger->debug(TAG, "Duration: {}", event->duration); + logger->debug(TAG, "Channel: {}", channel->number); } VEpgSetTimer::~VEpgSetTimer() @@ -244,7 +246,7 @@ int VEpgSetTimer::handleCommand(int command) void VEpgSetTimer::doit() { char* timerString = genTimerString(); - logger->log("VEPGST", Log::DEBUG, "%s", timerString); + logger->debug(TAG, "{}", timerString); ULONG ret = vdr->setEventTimer(timerString); delete[] timerString; @@ -254,9 +256,9 @@ void VEpgSetTimer::doit() Control::getInstance()->connectionLost(); } - if (ret == 0) logger->log("VEPGST", Log::DEBUG, "Success"); - else if (ret == 1) logger->log("VEPGST", Log::DEBUG, "Fail: Timer already set for this event"); - else if (ret == 2) logger->log("VEPGST", Log::DEBUG, "Fail: General failure setting timer"); + if (ret == 0) logger->debug(TAG, "Success"); + else if (ret == 1) logger->debug(TAG, "Fail: Timer already set for this event"); + else if (ret == 2) logger->debug(TAG, "Fail: General failure setting timer"); VInfo* vi = new VInfo(); vi->setSize(400, 150); diff --git a/vepgsettimer.h b/vepgsettimer.h index 943f27f..3cf7fff 100644 --- a/vepgsettimer.h +++ b/vepgsettimer.h @@ -25,7 +25,7 @@ class Event; class Channel; -class Log; +class LogNT; class VDR; class Message; class BoxStack; @@ -42,7 +42,7 @@ class VEpgSetTimer : public TBBoxx private: BoxStack* boxstack; - Log* logger; + LogNT* logger; VDR* vdr; Event* event; diff --git a/vopts.cc b/vopts.cc index 7cafc71..6a4589f 100644 --- a/vopts.cc +++ b/vopts.cc @@ -27,7 +27,7 @@ #include "boxstack.h" #include "woptionpane.h" #include "wremoteconfig.h" -#include "oldlog.h" +#include "log.h" #include "option.h" #include "vdr.h" #include "messagequeue.h" @@ -41,6 +41,8 @@ #include "vopts.h" +static const char* TAG = "VOpts"; + VOpts::VOpts() { setTitleBarOn(1); @@ -332,7 +334,7 @@ void VOpts::doSave() { if (options[i]->configChoice == options[i]->userSetChoice) continue; // no change - Log::getInstance()->log("Options", Log::DEBUG, "Option %i has changed", i); + LogNT::getInstance()->debug(TAG, "Option {} has changed", i); // Save to vdr @@ -372,22 +374,22 @@ void VOpts::doSave() { if (STRCASECMP(options[i]->optionkeys[options[i]->userSetChoice], "RGB+composite")==0) { - Log::getInstance()->log("Options", Log::DEBUG, "Setting RGB/Composite"); + LogNT::getInstance()->debug(TAG, "Setting RGB/Composite"); Video::getInstance()->setConnection(Video::COMPOSITERGB); } else if (STRCASECMP(options[i]->optionkeys[options[i]->userSetChoice], "S-Video")==0) { - Log::getInstance()->log("Options", Log::DEBUG, "Setting S-Video"); + LogNT::getInstance()->debug(TAG, "Setting S-Video"); Video::getInstance()->setConnection(Video::SVIDEO); } else if (STRCASECMP(options[i]->optionkeys[options[i]->userSetChoice], "HDMI")==0) { - Log::getInstance()->log("Options", Log::DEBUG, "Setting HDMI"); + LogNT::getInstance()->debug(TAG, "Setting HDMI"); Video::getInstance()->setConnection(Video::HDMI); } else if (STRCASECMP(options[i]->optionkeys[options[i]->userSetChoice], "HDMI3D")==0) { - Log::getInstance()->log("Options", Log::DEBUG, "Setting HDMI"); + LogNT::getInstance()->debug(TAG, "Setting HDMI"); Video::getInstance()->setConnection(Video::HDMI3D); } break; @@ -396,17 +398,17 @@ void VOpts::doSave() { if (STRCASECMP(options[i]->optionkeys[options[i]->userSetChoice], "16:9")==0) { - Log::getInstance()->log("Options", Log::DEBUG, "Setting 16:9 TV"); + LogNT::getInstance()->debug(TAG, "Setting 16:9 TV"); Video::getInstance()->setTVsize(Video::ASPECT16X9); } else if (STRCASECMP(options[i]->optionkeys[options[i]->userSetChoice], "4:3")==0) { - Log::getInstance()->log("Options", Log::DEBUG, "Setting 4:3 TV"); + LogNT::getInstance()->debug(TAG, "Setting 4:3 TV"); Video::getInstance()->setTVsize(Video::ASPECT4X3); } else if (STRCASECMP(options[i]->optionkeys[options[i]->userSetChoice], "14:9")==0) { - Log::getInstance()->log("Options", Log::DEBUG, "Setting 14:9 TV"); + LogNT::getInstance()->debug(TAG, "Setting 14:9 TV"); Video::getInstance()->setTVsize(Video::ASPECT14X9); } break; @@ -415,12 +417,12 @@ void VOpts::doSave() { if (options[i]->userSetChoice == 1) { - Log::getInstance()->log("Options", Log::DEBUG, "Setting letterbox"); + LogNT::getInstance()->debug(TAG, "Setting letterbox"); Video::getInstance()->setMode(Video::LETTERBOX); } else { - Log::getInstance()->log("Options", Log::DEBUG, "Setting chop-sides"); + LogNT::getInstance()->debug(TAG, "Setting chop-sides"); Video::getInstance()->setMode(Video::NORMAL); } break; @@ -436,7 +438,7 @@ void VOpts::doSave() else if (options[i]->userSetChoice == 5) newTCPsize = 16384; else if (options[i]->userSetChoice == 6) newTCPsize = 32768; else if (options[i]->userSetChoice == 7) newTCPsize = 65536; - Log::getInstance()->log("Options", Log::DEBUG, "Setting TCP window size %i", newTCPsize); + LogNT::getInstance()->debug(TAG, "Setting TCP window size {}", newTCPsize); VDR::getInstance()->setReceiveWindow(newTCPsize); break; } @@ -449,12 +451,12 @@ void VOpts::doSave() { if (options[i]->userSetChoice == 1) { - Log::getInstance()->log("Options", Log::DEBUG, "Setting automatic vdr shutdown"); + LogNT::getInstance()->debug(TAG, "Setting automatic vdr shutdown"); VDR::getInstance()->setVDRShutdown(true); } else { - Log::getInstance()->log("Options", Log::DEBUG, "Setting local shutdown"); + LogNT::getInstance()->debug(TAG, "Setting local shutdown"); VDR::getInstance()->setVDRShutdown(false); } break; @@ -463,12 +465,12 @@ void VOpts::doSave() { if (options[i]->userSetChoice == 1) { - Log::getInstance()->log("Options", Log::DEBUG, "Setting classic menu"); + LogNT::getInstance()->debug(TAG, "Setting classic menu"); Control::getInstance()->setAdvMenus(false); } else { - Log::getInstance()->log("Options", Log::DEBUG, "Setting advanced menu"); + LogNT::getInstance()->debug(TAG, "Setting advanced menu"); Control::getInstance()->setAdvMenus(true); } break; @@ -476,7 +478,7 @@ void VOpts::doSave() case 20: { SkinFactory::InitSkin(options[i]->userSetChoice); - Log::getInstance()->log("Options", Log::DEBUG, "Init Skin %d",options[i]->userSetChoice); + LogNT::getInstance()->debug(TAG, "Init Skin {}", options[i]->userSetChoice); break; } } diff --git a/vpicturebanner.cc b/vpicturebanner.cc index 60bde94..0fd2425 100644 --- a/vpicturebanner.cc +++ b/vpicturebanner.cc @@ -27,7 +27,7 @@ #include "vinfo.h" #include "boxstack.h" #include "i18n.h" -#include "oldlog.h" +#include "log.h" VPictureBanner::VPictureBanner(bool ld, bool sl) { @@ -39,7 +39,7 @@ VPictureBanner::VPictureBanner(bool ld, bool sl) setPosition(50, v->getScreenHeight()-50); setTitleBarOn(0); info=NULL; - Log::getInstance()->log("VPictureBanner",Log::DEBUG,"created %p",this); + LogNT::getInstance()->debug("VPictureBanner", "created {}", (void*)this); //TODO compute sizes from text rotsize=70; infsize=50; @@ -47,7 +47,7 @@ VPictureBanner::VPictureBanner(bool ld, bool sl) VPictureBanner::~VPictureBanner() { - Log::getInstance()->log("VPictureBanner",Log::DEBUG,"deleted %p",this); + LogNT::getInstance()->debug("VPictureBanner", "deleted {}", (void*)this); } diff --git a/vradiorec.cc b/vradiorec.cc index 9b24980..72f2e17 100644 --- a/vradiorec.cc +++ b/vradiorec.cc @@ -428,8 +428,8 @@ void VRadioRec::timercall(int clientReference) void VRadioRec::drawBarClocks() { - Log* logger = Log::getInstance(); - LogNT::getInstance()->debug(TAG, "Draw bar clocks"); + LogNT* logger = LogNT::getInstance(); + logger->debug(TAG, "Draw bar clocks"); // Draw RTC // Blank the area first diff --git a/vrecording.cc b/vrecording.cc index 90cf8b3..e30dcd7 100644 --- a/vrecording.cc +++ b/vrecording.cc @@ -34,11 +34,13 @@ #include "vrecordinglist.h" #include "recording.h" #include "message.h" -#include "oldlog.h" +#include "log.h" #include "wmovieview.h" #include "wseriesview.h" #include "wpictureview.h" +static const char* TAG = "VRecording"; + VRecording::VRecording(RecMan* trecman, Recording* trec) { rec = trec; @@ -46,9 +48,9 @@ VRecording::VRecording(RecMan* trecman, Recording* trec) buttons = true; selected = RESUME; - Log::getInstance()->log("VRecording", Log::DEBUG, "%s", rec->getProgName()); + LogNT::getInstance()->debug(TAG, "{}", rec->getProgName()); rec->loadRecInfo(); - Log::getInstance()->log("VRecording", Log::DEBUG, "%s", rec->getProgName()); + LogNT::getInstance()->debug(TAG, "{}", rec->getProgName()); if (Video::getInstance()->getFormat() == Video::PAL) diff --git a/vrecordinglist.cc b/vrecordinglist.cc index 5ed7819..7f3c1a4 100644 --- a/vrecordinglist.cc +++ b/vrecordinglist.cc @@ -19,6 +19,7 @@ #include "vrecordinglist.h" +#include "log.h" #include "recman.h" #include "directory.h" #include "recording.h" @@ -35,7 +36,8 @@ #include "i18n.h" #include "control.h" #include "vinfo.h" -#include "oldlog.h" + +static const char* TAG = "VRecordingList"; VRecordingList::VRecordingList() { @@ -52,7 +54,7 @@ VRecordingList::~VRecordingList() void VRecordingList::processMessage(Message* m) { - Log::getInstance()->log("VRecordingList", Log::DEBUG, "Got message value %lu", m->message); + LogNT::getInstance()->debug(TAG, "Got message value {}", m->message); if (m->message == Message::MOUSE_MOVE) { @@ -75,12 +77,12 @@ void VRecordingList::processMessage(Message* m) } else if (m->message == Message::DELETE_SELECTED_RECORDING) { - Log::getInstance()->log("VRecordingList", Log::DEBUG, "Doing delete selected"); + LogNT::getInstance()->debug(TAG, "Doing delete selected"); doDeleteSelected(); } else if (m->message == Message::MOVE_RECORDING) { - Log::getInstance()->log("VRecordingList", Log::DEBUG, "Doing move recording"); + LogNT::getInstance()->debug(TAG, "Doing move recording"); doMoveRecording(reinterpret_cast(m->parameter)); } else if (m->message == Message::PLAY_SELECTED_RECORDING) @@ -104,7 +106,7 @@ void VRecordingList::doDeleteSelected() if (!toDelete) return; - Log::getInstance()->log("VRecordingList", Log::DEBUG, "FOUND: %i %s %s", toDelete->index, toDelete->getProgName(), toDelete->getFileName()); + LogNT::getInstance()->debug(TAG, "FOUND: {} {} {}", toDelete->index, toDelete->getProgName(), toDelete->getFileName()); int success = recman->deleteRecording(toDelete); if (!VDR::getInstance()->isConnected()) @@ -144,7 +146,7 @@ void VRecordingList::doMoveRecording(Directory* toDir) Recording* toMove = getCurrentOptionRecording(); if (!toMove || !toDir) return; - Log::getInstance()->log("VRecordingList", Log::DEBUG, "MOVE: %s %s", toMove->getProgName(), toDir->name); + LogNT::getInstance()->debug(TAG, "MOVE: {} {}", toMove->getProgName(), toDir->name); int success = recman->moveRecording(toMove, toDir); if (!VDR::getInstance()->isConnected()) @@ -371,7 +373,7 @@ int VRecordingList::handleCommand(int command) Recording* current = getCurrentOptionRecording(); if (current) { - Log::getInstance()->log("VRecordingList", Log::DEBUG, "Found the option you pointed at. %s %s", current->getProgName(), current->getFileName()); + LogNT::getInstance()->debug(TAG, "Found the option you pointed at. {} {}", current->getProgName(), current->getFileName()); /* VRecordingMenu* v = new VRecordingMenu(recman); diff --git a/vrecordinglistadvanced.cc b/vrecordinglistadvanced.cc index bc85a41..5b10daa 100644 --- a/vrecordinglistadvanced.cc +++ b/vrecordinglistadvanced.cc @@ -37,7 +37,7 @@ #include "i18n.h" #include "control.h" #include "vinfo.h" -#include "oldlog.h" +#include "log.h" #include "movieinfo.h" #include "seriesinfo.h" #include "staticartwork.h" @@ -129,7 +129,7 @@ void VRecordingListAdvanced::drawData(bool doIndexPop) LOCALTIME_R(&recStartTime, &btime); strftime(tempA, 299, "%d/%m/%y %H:%M ", &btime); int check = SNPRINTF(tempB, 300, "%c\t%s\n \t%s", (currentRec->getNew() ? '*': ' '), currentRec->getProgName(), tempA); - if ((check < 0) || (check > 299)) Log::getInstance()->log("VRecordingsListAdvanced", Log::ERR, "String too big"); + if ((check < 0) || (check > 299)) LogNT::getInstance()->error("VRecordingsListAdvanced", "String too big"); // New TVMedia stuff TVMediaInfo *info= new TVMediaInfo(); diff --git a/vrecordinglistclassic.cc b/vrecordinglistclassic.cc index 8e46d78..c43e626 100644 --- a/vrecordinglistclassic.cc +++ b/vrecordinglistclassic.cc @@ -33,7 +33,7 @@ #include "i18n.h" #include "control.h" #include "vinfo.h" -#include "oldlog.h" +#include "log.h" #include "vrecordinglistclassic.h" @@ -99,7 +99,7 @@ void VRecordingListClassic::drawData(bool doIndexPop) LOCALTIME_R(&recStartTime, &btime); strftime(tempA, 300, "%d/%m %H:%M ", &btime); int check = SNPRINTF(tempB, 300, "%s\t%c\t%s", tempA, (currentRec->getNew() ? '*': ' '), currentRec->getProgName()); - if ((check < 0) || (check > 299)) Log::getInstance()->log("VRecordingListClassic", Log::ERR, "String too big"); + if ((check < 0) || (check > 299)) LogNT::getInstance()->error("VRecordingListClassic", "String too big"); currentRec->index = sl.addOption(tempB, 0, first); first = 0; diff --git a/vscreensaver.cc b/vscreensaver.cc index 523dc8e..b290b10 100644 --- a/vscreensaver.cc +++ b/vscreensaver.cc @@ -22,7 +22,6 @@ #include #include "defines.h" -#include "oldlog.h" #include "input.h" #include "colour.h" #include "video.h" diff --git a/vteletextview.cc b/vteletextview.cc index b45d19b..6b297f8 100644 --- a/vteletextview.cc +++ b/vteletextview.cc @@ -19,6 +19,7 @@ #include +#include "log.h" #include "video.h" #include "boxstack.h" #include "input.h" @@ -52,7 +53,7 @@ VTeletextView::VTeletextView(TeletextDecoderVBIEBU* TTdecoder, Boxx* playerview, VTeletextView::~VTeletextView() { - Log::getInstance()->log("VTeletextView", Log::DEBUG, "VTeletextView destruct"); + LogNT::getInstance()->debug("VTeletextView", "destruct"); pv->draw(); BoxStack::getInstance()->update(pv); ttdecoder->unRegisterTeletextView(this); @@ -60,7 +61,7 @@ VTeletextView::~VTeletextView() void VTeletextView::draw(bool completedraw, bool onlyfirstline) { - //Log::getInstance()->log("VTeletextView", Log::ERR, "Start draw"); + LogNT::getInstance()->error("VTeletextView", "Start draw"); Boxx::draw(); int x, y; @@ -92,10 +93,10 @@ void VTeletextView::draw(bool completedraw, bool onlyfirstline) ttdecoder->setChar(x, y, c); } } -// Log::getInstance()->log("VTeletextView", Log::ERR, "Line %d",y); +// LogNT::getInstance()->error("VTeletextView", "Line {}", y); if (onlyfirstline) break; } - // Log::getInstance()->log("VTeletextView", Log::ERR, "Start end"); + // LogNT::getInstance()->error("VTeletextView", "Start end"); } int VTeletextView::handleCommand(int command) diff --git a/vtimerlist.cc b/vtimerlist.cc index 4be53ca..e2dbd00 100644 --- a/vtimerlist.cc +++ b/vtimerlist.cc @@ -32,11 +32,13 @@ #include "control.h" #include "boxstack.h" #include "vinfo.h" -#include "oldlog.h" +#include "log.h" #include "staticartwork.h" #include "vtimerlist.h" +static const char* TAG = "VTimerList"; + VTimerList::VTimerList() { clockRegion.x = 420; @@ -150,7 +152,7 @@ bool VTimerList::load() LOCALTIME_R(&rectime, &btime); strftime(strA, 299, "%d/%m %H:%M ", &btime); int check = SNPRINTF(strB, 300, "%s\t%s", strA, recTimer->getName()); - if ((check < 0) || (check > 299)) Log::getInstance()->log("VTimerList", Log::ERR, "String too big"); + if ((check < 0) || (check > 299)) LogNT::getInstance()->error(TAG, "String too big"); sl.addOption(strB, recTimer, first); first = 0; } @@ -338,12 +340,12 @@ void VTimerList::processMessage(Message* m) { RecTimer* recTimer = reinterpret_cast(sl.getCurrentOptionData()); if (recTimer == NULL) return; - Log::getInstance()->log("VTimerList", Log::DEBUG, "Got timer to delete"); + LogNT::getInstance()->debug(TAG, "Got timer to delete"); ULONG retval = VDR::getInstance()->deleteTimer(recTimer); if (!VDR::getInstance()->isConnected()) { Control::getInstance()->connectionLost(); return; } - Log::getInstance()->log("VTimerList", Log::DEBUG, "Got return fron delete timer: %lu", retval); + LogNT::getInstance()->debug(TAG, "Got return fron delete timer: {}", retval); if (retval != 10) { diff --git a/vvideorec.cc b/vvideorec.cc index 63b9b8d..a626d28 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -35,13 +35,15 @@ #include "i18n.h" #include "bitmap.h" #include "recinfo.h" -#include "oldlog.h" +#include "log.h" #include "channel.h" #include "vteletextview.h" #include "messagequeue.h" #include "vvideorec.h" +static const char* TAG = "VVideoRec"; + VVideoRec::VVideoRec(Recording* rec, bool ish264) { boxstack = BoxStack::getInstance(); @@ -81,7 +83,7 @@ VVideoRec::VVideoRec(Recording* rec, bool ish264) delete[] cendMargin; } - Log::getInstance()->log("VVideoRec", Log::DEBUG, "SM: %u EM: %u", startMargin, endMargin); + LogNT::getInstance()->debug(TAG, "SM: {} EM: {}", startMargin, endMargin); setSize(video->getScreenWidth(), video->getScreenHeight()); createBuffer(); @@ -136,7 +138,7 @@ void VVideoRec::preDelete() VVideoRec::~VVideoRec() { - Log::getInstance()->log("VVideoRec", Log::DEBUG, "Entering vvideorec destructor"); + LogNT::getInstance()->debug(TAG, "Entering vvideorec destructor"); video->setDefaultAspect(); @@ -160,7 +162,7 @@ void VVideoRec::go(bool resume) else startFrameNum = 0; - Log::getInstance()->log("VVideoRec", Log::DEBUG, "Starting stream: %s at frame: %lu", myRec->getFileName(), startFrameNum); + LogNT::getInstance()->debug(TAG, "Starting stream: {} at frame: {}", myRec->getFileName(), startFrameNum); ULONG lengthFrames = 0; bool isPesRecording; ULLONG lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames, &isPesRecording); @@ -296,14 +298,14 @@ int VVideoRec::handleCommand(int command) if (myRec->hasMarks()) { // skip to previous mark - Log* logger = Log::getInstance(); + LogNT* logger = LogNT::getInstance(); int currentFrame = (player->getCurrentFrameNum()); // get current Frame currentFrame -= static_cast(5 * myRec->recInfo->fps); // subtrack 5 seconds, else you cannot skip more than once back .. int prevMark = myRec->getPrevMark(currentFrame); // find previous Frame if (prevMark) { - logger->log("VVideoRec", Log::NOTICE, "jump back from pos %i to mark at %i",currentFrame,prevMark); + logger->info(TAG, "jump back from pos {} to mark at {}",currentFrame,prevMark); player->jumpToMark(prevMark); } doBar(4); @@ -320,14 +322,14 @@ int VVideoRec::handleCommand(int command) if (myRec->hasMarks()) { // skip to next mark - Log* logger = Log::getInstance(); + LogNT* logger = LogNT::getInstance(); int currentFrame = (player->getCurrentFrameNum()); int nextMark = myRec->getNextMark(currentFrame); if (nextMark) { - logger->log("VVideoRec", Log::NOTICE, "jump forward from pos %i to mark at %i",currentFrame,nextMark); + logger->info(TAG, "jump forward from pos {} to mark at {}", currentFrame,nextMark); player->jumpToMark(nextMark); } doBar(3); @@ -442,7 +444,7 @@ void VVideoRec::doTeletext() void VVideoRec::processMessage(Message* m) { - Log::getInstance()->log("VVideoRec", Log::DEBUG, "Message received"); + LogNT::getInstance()->debug(TAG, "Message received"); if (m->message == Message::MOUSE_LBDOWN) { @@ -547,12 +549,12 @@ void VVideoRec::processMessage(Message* m) } else if (m->message == Message::AUDIO_CHANGE_CHANNEL) { - Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change audio channel to %i", m->parameter); + LogNT::getInstance()->debug(TAG, "Received change audio channel to {}", m->parameter); player->setAudioChannel(m->parameter&0xFFFF,(m->parameter&0xFF0000)>> 16,(m->parameter&0xFF000000)>> 24 ); } else if (m->message == Message::SUBTITLE_CHANGE_CHANNEL) { - Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change subtitle channel to %i", m->parameter); + LogNT::getInstance()->debug(TAG, "Received change subtitle channel to {}", m->parameter); int type=((m->parameter & 0xFF0000)>>16); switch (type) { case 0x10: { //dvbsubtitle @@ -598,20 +600,20 @@ void VVideoRec::processMessage(Message* m) void VVideoRec::stopPlay() { - Log::getInstance()->log("VVideoRec", Log::DEBUG, "Pre stopPlay"); + LogNT::getInstance()->debug(TAG, "Pre stopPlay"); removeBar(); - Log::getInstance()->log("VVideoRec", Log::DEBUG, "1"); + LogNT::getInstance()->debug(TAG, "1"); player->stop(); - Log::getInstance()->log("VVideoRec", Log::DEBUG, "2"); + LogNT::getInstance()->debug(TAG, "2"); vdr->stopStreaming(); - Log::getInstance()->log("VVideoRec", Log::DEBUG, "3"); + LogNT::getInstance()->debug(TAG, "3"); delete player; playing = false; if (!vdr->isConnected()) { Control::getInstance()->connectionLost(); return; } - Log::getInstance()->log("VVideoRec", Log::DEBUG, "Post stopPlay"); + LogNT::getInstance()->debug(TAG, "Post stopPlay"); } void VVideoRec::toggleChopSides() @@ -851,7 +853,7 @@ void VVideoRec::doBar(int action_in) if (!barGenHold && !barScanHold && !barVasHold) timers->setTimerD(this, 1, 4); - Log::getInstance()->log("VVideoRec", Log::DEBUG, "player state: %i", playerState); + LogNT::getInstance()->debug(TAG, "player state: {}", playerState); if ((playerState == PlayerVideoRec::S_PAUSE_P) || (playerState == PlayerVideoRec::S_PAUSE_I)) timers->cancelTimer(this, 2); @@ -904,8 +906,8 @@ void VVideoRec::drawBarClocks() } } - Log* logger = Log::getInstance(); - logger->log("VVideoRec", Log::DEBUG, "Draw bar clocks"); + LogNT* logger = LogNT::getInstance(); + logger->debug(TAG, "Draw bar clocks"); // Draw RTC // Blank the area first @@ -949,7 +951,7 @@ void VVideoRec::drawBarClocks() else { SNPRINTF(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", currentFrameHMSF.hours, currentFrameHMSF.minutes, currentFrameHMSF.seconds, lengthHMSF.hours, lengthHMSF.minutes, lengthHMSF.seconds); - logger->log("VVideoRec", Log::DEBUG, buffer); + logger->debug(TAG, buffer); } drawText(buffer, clocksRegion.x, clocksRegion.y, DrawStyle::LIGHTTEXT); @@ -977,9 +979,9 @@ void VVideoRec::drawBarClocks() { int nrWidth = 302 * (lengthFrames - player->getLengthFrames()) / lengthFrames; - Log::getInstance()->log("GVASDF", Log::DEBUG, "Length Frames: %lu", lengthFrames); - Log::getInstance()->log("GVASDF", Log::DEBUG, "Player lf: %lu", player->getLengthFrames()); - Log::getInstance()->log("GVASDF", Log::DEBUG, "NR WDITH: %i", nrWidth); + LogNT::getInstance()->debug("GVASDF", "Length Frames: {}", lengthFrames); + LogNT::getInstance()->debug("GVASDF", "Player lf: {}", player->getLengthFrames()); + LogNT::getInstance()->debug("GVASDF", "NR WDITH: {}", nrWidth); rectangle(barRegion.x + progBarXbase + 4 + 302 - nrWidth, barRegion.y + 16, nrWidth, 16, DrawStyle::RED); } @@ -998,7 +1000,7 @@ void VVideoRec::drawBarClocks() loopMark = *i; if (loopMark->pos) { - logger->log("VVideoRec", Log::DEBUG, "Drawing mark at frame %i", loopMark->pos); + logger->debug(TAG, "Drawing mark at frame {}", loopMark->pos); posPix = 302 * loopMark->pos / lengthFrames; rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER); } diff --git a/vwelcome.cc b/vwelcome.cc index db16293..a3bace7 100644 --- a/vwelcome.cc +++ b/vwelcome.cc @@ -18,7 +18,7 @@ */ -#include "oldlog.h" +#include "log.h" #include "input.h" #include "vdr.h" #include "vchannellist.h" diff --git a/wjpeg.cc b/wjpeg.cc index 193a72a..57235bf 100644 --- a/wjpeg.cc +++ b/wjpeg.cc @@ -30,7 +30,6 @@ #endif #include "i18n.h" -#include "oldlog.h" #include "surface.h" diff --git a/wjpegsimple.cc b/wjpegsimple.cc index 37967bd..61b7f52 100644 --- a/wjpegsimple.cc +++ b/wjpegsimple.cc @@ -23,44 +23,28 @@ #include #include - - #include "i18n.h" -#include "oldlog.h" #include "surface.h" - - - -WJpegSimple::WJpegSimple(){ - +WJpegSimple::WJpegSimple() +{ } -WJpegSimple::~WJpegSimple() { - +WJpegSimple::~WJpegSimple() +{ } int WJpegSimple::init(const char* tfileName) { - fileName=tfileName; - + fileName = tfileName; return 1; } - - - - void WJpegSimple::draw() { - int width,height; - width=height=1; - drawJpeg(fileName,0,0,&width,&height);//This should went into the abstract base classes? - //Windows has a problem with the leading / fixme - setDimensions(width, height); - + int width,height; + width=height=1; + drawJpeg(fileName,0,0,&width,&height);//This should went into the abstract base classes? + //Windows has a problem with the leading / fixme + setDimensions(width, height); } - - - - diff --git a/woptionbox.cc b/woptionbox.cc index 20b4cab..fc9f8a3 100644 --- a/woptionbox.cc +++ b/woptionbox.cc @@ -18,7 +18,6 @@ */ #include "colour.h" -#include "oldlog.h" #ifndef WIN32 #include "unistd.h" #endif diff --git a/woptionpane.cc b/woptionpane.cc index 007b45d..9cdb79d 100644 --- a/woptionpane.cc +++ b/woptionpane.cc @@ -20,7 +20,7 @@ #include "wtextbox.h" #include "i18n.h" #include "woptionbox.h" -#include "oldlog.h" +#include "log.h" #include "vdr.h" #include "input.h" #include "option.h" @@ -87,7 +87,7 @@ void WOptionPane::addOptionLine(Option* option) { for (UINT j = 0; j < option->numChoices; j++) { - Log::getInstance()->log("Options", Log::DEBUG, "Add option: %s", option->options[j]); + LogNT::getInstance()->debug("Options", "Add option: {}", option->options[j]); ob->addOption(tr(option->options[j])); } diff --git a/wremoteconfig.cc b/wremoteconfig.cc index 8f7386c..5377d61 100644 --- a/wremoteconfig.cc +++ b/wremoteconfig.cc @@ -19,7 +19,6 @@ #include -#include "oldlog.h" #include "input.h" #include "inputman.h" #include "wsymbol.h" diff --git a/wselectlist.cc b/wselectlist.cc index 6fe0c4e..b618e6a 100644 --- a/wselectlist.cc +++ b/wselectlist.cc @@ -21,7 +21,6 @@ #include #include "colour.h" -#include "oldlog.h" #include "wselectlist.h" diff --git a/wtabbar.cc b/wtabbar.cc index c28fabb..3a1cf11 100644 --- a/wtabbar.cc +++ b/wtabbar.cc @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "log.h" #include "wtabbar.h" #include "surface.h" #include "input.h" @@ -179,7 +180,7 @@ int WTabBar::handleCommand(int command) } else { - Log::getInstance()->log("WTabBar", Log::ERR, "Up/Down client returned not 1 or 4"); + LogNT::getInstance()->error("WTabBar", "Up/Down client returned not 1 or 4"); } } } -- 2.39.5