[mythtv] [PATCH] More mythlog entries (Update1)

Kevin Kuphal kuphal at dls.net
Thu Sep 2 00:37:30 EDT 2004


Kevin Kuphal wrote:

> This patch adds new mythlog entries for the following and their level
>
> - Started recording (NOTICE)
> - Finished recording (NOTICE)
> - Items scheduled (INFO)
> - AutoExpiration of items (NOTICE)
>
> I hope to include more items soon.  If anyone has particular messages 
> they would like to see in the logs, let me know.  With the previous 
> patch to show the log entries in the status screen, this should be 
> more useful to monitor the health of the system now.
>
> Kevin

Once again, I'm updating the patch.  Forgot to include the following:

- Commflag start (NOTICE)
- Commflag abort (WARNING)
- Commflag end (NOTICE)
- MaxItems expiration of items (NOTICE)

Thanks,
Kevin
-------------- next part --------------
Index: mythtv/libs/libmythtv/scheduledrecording.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/scheduledrecording.cpp,v
retrieving revision 1.109
diff -n -u -r1.109 scheduledrecording.cpp
--- mythtv/libs/libmythtv/scheduledrecording.cpp	6 Aug 2004 17:34:55 -0000	1.109
+++ mythtv/libs/libmythtv/scheduledrecording.cpp	2 Sep 2004 04:34:55 -0000
@@ -398,6 +398,15 @@
     if (getRecordingType() == kFindOneRecord)
         remove(db);
 
+    QString msg;
+  
+    msg = QString("Finished recording %1 on channel: %2")
+                  .arg(proginfo.title.utf8())
+                  .arg(proginfo.chanid);
+
+    VERBOSE(VB_GENERAL, msg);
+    gContext->LogEntry("scheduler", LP_NOTICE, "Finished recording", msg);
+
     addHistory(db, proginfo);
 }
 
Index: mythtv/programs/mythbackend/autoexpire.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/autoexpire.cpp,v
retrieving revision 1.14
diff -n -u -r1.14 autoexpire.cpp
--- mythtv/programs/mythbackend/autoexpire.cpp	31 May 2004 22:07:07 -0000	1.14
+++ mythtv/programs/mythbackend/autoexpire.cpp	2 Sep 2004 04:34:55 -0000
@@ -83,6 +83,7 @@
                                       .arg(pginfo->startts.toString())
                                       .arg((int)(pginfo->filesize/1024/1024));
                 VERBOSE(VB_GENERAL, msg);
+                gContext->LogEntry("AutoExpire", LP_NOTICE, "Expired Program", msg);
 
                 QString message =
                            QString("AUTO_EXPIRE %1 %2")
@@ -179,6 +180,7 @@
                                           .arg(maxIter.key())
                                           .arg(query.value(1).toString());
                     VERBOSE(VB_GENERAL, msg);
+                    gContext->LogEntry("mythbackend", LP_NOTICE, "Expired program", msg);
 
                     QString message = QString("AUTO_EXPIRE %1 %2")
                                               .arg(query.value(0).toString())
Index: mythtv/programs/mythbackend/commercialflag.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/commercialflag.cpp,v
retrieving revision 1.5
diff -n -u -r1.5 commercialflag.cpp
--- mythtv/programs/mythbackend/commercialflag.cpp	22 Jul 2004 04:15:37 -0000	1.5
+++ mythtv/programs/mythbackend/commercialflag.cpp	2 Sep 2004 04:34:55 -0000
@@ -169,28 +169,33 @@
     NuppelVideoPlayer *nvp = new NuppelVideoPlayer(commthread_db, program_info);
     nvp->SetRingBuffer(tmprbuf);
 
-    QString msg = QString( "Started Commercial Flagging for '%1' recorded from "
+    QString msg = QString( "Started Commercial Flagging for \"%1\" recorded from "
                            "channel %2 at %3" )
                            .arg(program_info->title.local8Bit())
                            .arg(program_info->chanid)
                            .arg(program_info->startts.toString());
     VERBOSE( VB_GENERAL, msg );
+    gContext->LogEntry("commflag", LP_NOTICE, "Commercial Flagging Started", msg);
 
     int breaksFound = nvp->FlagCommercials(false, dontSleep, &abortFlagging);
 
     if ( *(flaggingSems[key]) )
-        msg = QString( "ABORTED Commercial Flagging for '%1' recorded from "
+    {
+        msg = QString( "ABORTED Commercial Flagging for \"%1\" recorded from "
                        "channel %2 at %3" )
                        .arg(program_info->title.local8Bit())
                        .arg(program_info->chanid)
                        .arg(program_info->startts.toString());
-    else
-        msg = QString( "Finished Commercial Flagging for '%1' recorded from "
+        gContext->LogEntry("commflag", LP_WARNING, "Commercial Flagging Aborted", msg);
+    } else {
+        msg = QString( "Finished Commercial Flagging for \"%1\" recorded from "
                        "channel %2 at %3.  Found %4 commercial break(s)." )
                        .arg(program_info->title.local8Bit())
                        .arg(program_info->chanid)
                        .arg(program_info->startts.toString())
                        .arg(breaksFound);
+        gContext->LogEntry("commflag", LP_NOTICE, "Commercial Flagging Finished", msg);
+    }
     VERBOSE( VB_GENERAL, msg );
 
     flaggingSems.erase(key);
Index: mythtv/programs/mythbackend/scheduler.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/scheduler.cpp,v
retrieving revision 1.112
diff -n -u -r1.112 scheduler.cpp
--- mythtv/programs/mythbackend/scheduler.cpp	19 Aug 2004 02:02:24 -0000	1.112
+++ mythtv/programs/mythbackend/scheduler.cpp	2 Sep 2004 04:34:55 -0000
@@ -829,10 +829,14 @@
             FillRecordLists();
             gettimeofday(&fillend, NULL);
             PrintList();
-            VERBOSE(VB_GENERAL, QString("Scheduled %1 items in %2 seconds.")
+            QString msg;
+            msg = QString("Scheduled %1 items in %2 seconds.")
                     .arg(reclist.size())
                     .arg(((fillend.tv_sec  - fillstart.tv_sec ) * 1000000 +
-                         (fillend.tv_usec - fillstart.tv_usec)) / 1000000.0));
+                         (fillend.tv_usec - fillstart.tv_usec)) / 1000000.0);
+
+            VERBOSE(VB_GENERAL, msg);
+            gContext->LogEntry("scheduler", LP_INFO, "Scheduled items", msg);
 
             lastupdate = curtime;
             startIter = reclist.begin();
@@ -1015,6 +1019,7 @@
                 .arg(nextRecording->cardid)
                 .arg(nextRecording->sourceid);
             VERBOSE(VB_GENERAL, msg);
+            gContext->LogEntry("scheduler", LP_NOTICE, "Schedule Change", msg);
         }
 
         if (statuschanged)


More information about the mythtv-dev mailing list