94 changes: 49 additions & 45 deletions mythtv/libs/libmyth/mediamonitor-darwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ MythMediaType FindMediaType(io_service_t service)
kern_return_t kernResult;
io_iterator_t iter;
MythMediaType mediaType = MEDIATYPE_UNKNOWN;
QString msg = QString("FindMediaType() - ");
bool isWholeMedia = false;

// Create an iterator across all parents of the service object passed in.
Expand All @@ -54,11 +53,12 @@ MythMediaType FindMediaType(io_service_t service)
&iter);

if (KERN_SUCCESS != kernResult)
VERBOSE(VB_IMPORTANT, (msg + "IORegistryEntryCreateIterator"
+ " returned %1").arg(kernResult));
LogPrint(VB_GENERAL, LOG_CRIT,
QString("IORegistryEntryCreateIterator returned %1")
.arg(kernResult));
else if (!iter)
VERBOSE(VB_IMPORTANT, msg + "IORegistryEntryCreateIterator"
+ " returned a NULL iterator");
LogPrint(VB_GENERAL, LOG_CRIT,
"IORegistryEntryCreateIterator returned NULL iterator");
else
{
// A reference on the initial service object is released in
Expand All @@ -76,9 +76,9 @@ MythMediaType FindMediaType(io_service_t service)
(service, CFSTR(kIOMediaWholeKey),
kCFAllocatorDefault, 0);

if (NULL == wholeMedia)
VERBOSE(VB_IMPORTANT,
msg + "Could not retrieve Whole property");
if (!wholeMedia)
LogPrint(VB_GENERAL, LOG_ALERT,
"Could not retrieve Whole property");
else
{
isWholeMedia = CFBooleanGetValue((CFBooleanRef)wholeMedia);
Expand Down Expand Up @@ -120,15 +120,15 @@ MythMediaType MediaTypeForBSDName(const char *bsdName)

if (!bsdName || !*bsdName)
{
VERBOSE(VB_IMPORTANT, msg + " - Error. No name supplied?");
LogPrint(VB_GENERAL, LOG_ALERT, msg + " - No name supplied?");
return MEDIATYPE_UNKNOWN;
}

matchingDict = IOBSDNameMatching(sMasterPort, 0, bsdName);
if (NULL == matchingDict)
if (!matchingDict)
{
VERBOSE(VB_IMPORTANT, msg + " - Error. IOBSDNameMatching()"
+ " returned a NULL dictionary.");
LogPrint(VB_GENERAL, LOG_ALERT,
msg + " - IOBSDNameMatching() returned a NULL dictionary.");
return MEDIATYPE_UNKNOWN;
}

Expand All @@ -138,14 +138,16 @@ MythMediaType MediaTypeForBSDName(const char *bsdName)

if (KERN_SUCCESS != kernResult)
{
VERBOSE(VB_IMPORTANT, (msg + " - Error. IOServiceGetMatchingServices()"
+ " returned %2").arg(kernResult));
LogPrint(VB_GENERAL, LOG_ALERT,
QString(msg + " - IOServiceGetMatchingServices() returned %2")
.arg(kernResult));
return MEDIATYPE_UNKNOWN;
}
if (!iter)
{
VERBOSE(VB_IMPORTANT, msg + " - Error. IOServiceGetMatchingServices()"
+ " returned a NULL iterator");
LogPrint(VB_GENERAL, LOG_ALERT,
msg + " - IOServiceGetMatchingServices() returned a NULL "
"iterator");
return MEDIATYPE_UNKNOWN;
}

Expand All @@ -157,8 +159,8 @@ MythMediaType MediaTypeForBSDName(const char *bsdName)

if (!service)
{
VERBOSE(VB_IMPORTANT, msg + " - Error. IOIteratorNext()"
+ " returned a NULL iterator");
LogPrint(VB_GENERAL, LOG_ALERT,
msg + " - IOIteratorNext() returned a NULL iterator");
return MEDIATYPE_UNKNOWN;
}
mediaType = FindMediaType(service);
Expand Down Expand Up @@ -186,8 +188,8 @@ static char * getVolName(CFDictionaryRef diskDetails)
volName = (char *) malloc(size);
if (!volName)
{
VERBOSE(VB_IMPORTANT,
QString("getVolName() - Error. Can't malloc(%1)?").arg(size));
LogPrint(VB_GENERAL, LOG_ALERT,
QString("getVolName() - Can't malloc(%1)?").arg(size));
return NULL;
}

Expand Down Expand Up @@ -257,19 +259,18 @@ void diskAppearedCallback(DADiskRef disk, void *context)
MythMediaType mediaType;
QString model;
MonitorThreadDarwin *mtd;
QString msg = "diskAppearedCallback() - ";
char *volName;


if (!BSDname)
{
VERBOSE(VB_MEDIA, msg + "Skipping non-local device");
LogPrint(VB_MEDIA, LOG_INFO, "Skipping non-local device");
return;
}

if (!context)
{
VERBOSE(VB_IMPORTANT, msg + "Error. Invoked with a NULL context.");
LogPrint(VB_GENERAL, LOG_ALERT, "Error. Invoked with a NULL context.");
return;
}

Expand All @@ -286,7 +287,7 @@ void diskAppearedCallback(DADiskRef disk, void *context)
if (kCFBooleanFalse ==
CFDictionaryGetValue(details, kDADiskDescriptionMediaRemovableKey))
{
VERBOSE(VB_MEDIA, msg + "Skipping non-removable " + BSDname);
LogPrint(VB_MEDIA, LOG_INFO, "Skipping non-removable " + BSDname);
CFRelease(details);
return;
}
Expand All @@ -295,7 +296,7 @@ void diskAppearedCallback(DADiskRef disk, void *context)
volName = getVolName(details);
if (!volName)
{
VERBOSE(VB_MEDIA, msg + "No volume name for dev " + BSDname);
LogPrint(VB_MEDIA, LOG_INFO, "No volume name for dev " + BSDname);
CFRelease(details);
return;
}
Expand All @@ -308,7 +309,7 @@ void diskAppearedCallback(DADiskRef disk, void *context)
// We know it is removable, and have guessed the type.
// Call a helper function to create appropriate objects and insert

VERBOSE(VB_MEDIA, QString("Found disk %1 - volume name '%2'.")
LogPrint(VB_MEDIA, LOG_INFO, QString("Found disk %1 - volume name '%2'.")
.arg(BSDname).arg(volName));

mtd->diskInsert(BSDname, volName, model, isCDorDVD);
Expand All @@ -334,7 +335,7 @@ void diskChangedCallback(DADiskRef disk, CFArrayRef keys, void *context)
CFDictionaryRef details = DADiskCopyDescription(disk);
char *volName = getVolName(details);

VERBOSE(VB_MEDIA, QString("Disk %1 - changed name to '%2'.")
LogPrint(VB_MEDIA, LOG_INFO, QString("Disk %1 - changed name to '%2'.")
.arg(BSDname).arg(volName));

reinterpret_cast<MonitorThreadDarwin *>(context)
Expand Down Expand Up @@ -394,9 +395,8 @@ void MonitorThreadDarwin::diskInsert(const char *devName,
QString model, bool isCDorDVD)
{
MythMediaDevice *media;
QString msg = "MonitorThreadDarwin::diskInsert";

VERBOSE(VB_MEDIA, (msg + "(%1,%2,'%3',%4)")
LogPrint(VB_MEDIA, LOG_DEBUG, QString("(%1,%2,'%3',%4)")
.arg(devName).arg(volName).arg(model).arg(isCDorDVD));

if (isCDorDVD)
Expand All @@ -406,8 +406,7 @@ void MonitorThreadDarwin::diskInsert(const char *devName,

if (!media)
{
VERBOSE(VB_IMPORTANT,
msg + " - Error. Couldn't create MythMediaDevice.");
LogPrint(VB_GENERAL, LOG_ALERT, "Couldn't create MythMediaDevice.");
return;
}

Expand All @@ -434,7 +433,7 @@ void MonitorThreadDarwin::diskInsert(const char *devName,

void MonitorThreadDarwin::diskRemove(QString devName)
{
VERBOSE(VB_MEDIA,
LogPrint(VB_MEDIA, LOG_DEBUG,
QString("MonitorThreadDarwin::diskRemove(%1)").arg(devName));

if (m_Monitor->m_SendEvent)
Expand All @@ -444,7 +443,8 @@ void MonitorThreadDarwin::diskRemove(QString devName)
if (pDevice) // Probably should ValidateAndLock() here?
pDevice->setStatus(MEDIASTAT_NODISK);
else
VERBOSE(VB_MEDIA, "Couldn't find MythMediaDevice: " + devName);
LogPrint(VB_MEDIA, LOG_INFO,
"Couldn't find MythMediaDevice: " + devName);
}

m_Monitor->RemoveDevice(devName);
Expand All @@ -458,7 +458,8 @@ void MonitorThreadDarwin::diskRemove(QString devName)
*/
void MonitorThreadDarwin::diskRename(const char *devName, const char *volName)
{
VERBOSE(VB_MEDIA, QString("MonitorThreadDarwin::diskRename(%1,%2)")
LogPrint(VB_MEDIA, LOG_DEBUG,
QString("MonitorThreadDarwin::diskRename(%1,%2)")
.arg(devName).arg(volName));

MythMediaDevice *pDevice = m_Monitor->GetMedia(devName);
Expand All @@ -479,7 +480,8 @@ void MonitorThreadDarwin::diskRename(const char *devName, const char *volName)
m_Monitor->Unlock(pDevice);
}
else
VERBOSE(VB_MEDIA, QString("Couldn't find MythMediaDevice: ") + devName);
LogPrint(VB_MEDIA, LOG_INFO,
"Couldn't find MythMediaDevice: " + devName);
}

/**
Expand Down Expand Up @@ -509,7 +511,7 @@ void MediaMonitorDarwin::StartMonitoring(void)

qRegisterMetaType<MythMediaStatus>("MythMediaStatus");

VERBOSE(VB_MEDIA, "Starting MediaMonitor");
LogPrint(VB_MEDIA, LOG_NOTICE, "Starting MediaMonitor");
m_Active = true;
m_Thread->start();
}
Expand All @@ -521,9 +523,9 @@ void MediaMonitorDarwin::StartMonitoring(void)
*/
bool MediaMonitorDarwin::AddDevice(MythMediaDevice* pDevice)
{
if ( ! pDevice )
if ( !pDevice )
{
VERBOSE(VB_IMPORTANT, "Error - MediaMonitor::AddDevice(null)");
LogPrint(VB_GENERAL, LOG_ALERT, "MediaMonitor::AddDevice(null)");
return false;
}

Expand Down Expand Up @@ -611,7 +613,7 @@ QStringList MediaMonitorDarwin::GetCDROMBlockDevices()
devices = IOServiceMatching(kIOBlockStorageDeviceClass);
if (!devices)
{
VERBOSE(VB_IMPORTANT, msg + "No Storage Devices? Unlikely!");
LogPrint(VB_GENERAL, LOG_ALERT, msg + "No Storage Devices? Unlikely!");
return list;
}

Expand All @@ -620,14 +622,15 @@ QStringList MediaMonitorDarwin::GetCDROMBlockDevices()

if (KERN_SUCCESS != kernResult)
{
VERBOSE(VB_IMPORTANT, (msg + "IORegistryEntryCreateIterator"
+ " returned %1").arg(kernResult));
LogPrint(VB_GENERAL, LOG_ALERT,
QString("IORegistryEntryCreateIterator returned %1")
.arg(kernResult));
return list;
}
if (!iter)
{
VERBOSE(VB_IMPORTANT, msg + "IORegistryEntryCreateIterator"
+ " returned a NULL iterator");
LogPrint(VB_GENERAL, LOG_ALERT,
"IORegistryEntryCreateIterator returned a NULL iterator");
return list;
}

Expand All @@ -647,12 +650,13 @@ QStringList MediaMonitorDarwin::GetCDROMBlockDevices()
QString desc = getModel(drive);

list.append(desc);
VERBOSE(VB_MEDIA, desc.prepend("Found CD/DVD: "));
LogPrint(VB_MEDIA, LOG_INFO, desc.prepend("Found CD/DVD: "));
CFRelease(p);
}
}
else
VERBOSE(VB_IMPORTANT, msg + "Could not retrieve drive properties");
LogPrint(VB_GENERAL, LOG_ALERT,
msg + "Could not retrieve drive properties");

IOObjectRelease(drive);
}
Expand Down
94 changes: 55 additions & 39 deletions mythtv/libs/libmyth/mediamonitor-unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,19 @@ const char * MediaMonitorUnix::kUDEV_FIFO = "/tmp/mythtv_media";

static const QString LOC = QString("MMUnix:");

// TODO: are these used?
static void fstabError(const QString &methodName)
{
VERBOSE(VB_IMPORTANT, LOC + methodName + " Error: failed to open "
+ _PATH_FSTAB + " for reading, " + ENO);
LogPrint(VB_GENERAL, LOG_ALERT,
LOC + methodName + " Error: failed to open " + _PATH_FSTAB +
" for reading, " + ENO);
}

static void statError(const QString &methodName, const QString devPath)
{
VERBOSE(VB_IMPORTANT, LOC + methodName + " Error: failed to stat "
+ devPath + ", " + ENO);
LogPrint(VB_GENERAL, LOG_ALERT,
LOC + methodName + " Error: failed to stat " + devPath +
", " + ENO);
}

////////////////////////////////////////////////////////////////////////
Expand All @@ -111,7 +114,7 @@ MediaMonitorUnix::MediaMonitorUnix(QObject* par,
CheckFileSystemTable();
CheckMountable();

VERBOSE(VB_MEDIA, "Initial device list...\n" + listDevices());
LogPrint(VB_MEDIA, LOG_INFO, "Initial device list...\n" + listDevices());
}


Expand Down Expand Up @@ -195,8 +198,9 @@ bool MediaMonitorUnix::CheckMountable(void)
QDBusConnection::systemBus() );
if (!iface.isValid())
{
VERBOSE(VB_IMPORTANT, LOC + ":CheckMountable: DBus interface error: " +
iface.lastError().message() );
LogPrint(VB_GENERAL, LOG_ALERT,
"CheckMountable: DBus interface error: " +
iface.lastError().message() );
return false;
}

Expand All @@ -205,8 +209,9 @@ bool MediaMonitorUnix::CheckMountable(void)
QDBusReply<QDBusObjectPathList> reply = iface.call("EnumerateDevices");
if (!reply.isValid())
{
VERBOSE(VB_IMPORTANT, LOC + ":CheckMountable DBus EnumerateDevices error: " +
reply.error().message() );
LogPrint(VB_GENERAL, LOG_ALERT,
"CheckMountable DBus EnumerateDevices error: " +
reply.error().message() );
return false;
}

Expand Down Expand Up @@ -279,19 +284,19 @@ bool MediaMonitorUnix::CheckRemovable(const QString &dev)
if (removable.exists() && removable.open(QIODevice::ReadOnly))
{
char c = 0;
QString msg = LOC + ":CheckRemovable(" + dev + ")/removable ";
QString msg = "CheckRemovable(" + dev + ")/removable ";
bool ok = removable.getChar(&c);
removable.close();

if (ok)
{
VERBOSE(VB_MEDIA+VB_EXTRA, msg + c);
LogPrint(VB_MEDIA, LOG_DEBUG, msg + c);
if (c == '1')
return true;
}
else
{
VERBOSE(VB_IMPORTANT, msg + "failed");
LogPrint(VB_GENERAL, LOG_ALERT, msg + "failed");
}
}
return false;
Expand All @@ -307,7 +312,7 @@ bool MediaMonitorUnix::CheckRemovable(const QString &dev)
*/
QString MediaMonitorUnix::GetDeviceFile(const QString &sysfs)
{
QString msg = LOC + ":GetDeviceFile(" + sysfs + ")";
QString msg = "GetDeviceFile(" + sysfs + ")";
QString ret = sysfs;

// In case of error, a working default? (device names usually match)
Expand All @@ -334,31 +339,35 @@ QString MediaMonitorUnix::GetDeviceFile(const QString &sysfs)
// device with partitions. FindPartition locates a partition
// in sysfs but udev hasn't created the devnode for it yet.
// Udev will send another AddDevice for the partition later.
VERBOSE(VB_MEDIA+VB_EXTRA, msg + " devnode not (yet) known");
LogPrint(VB_MEDIA, LOG_DEBUG, msg + " devnode not (yet) known");
}

udev_device_unref(device);
}
else
{
VERBOSE(VB_IMPORTANT, msg + " udev_device_new_from_syspath returned NULL");
LogPrint(VB_GENERAL, LOG_ALERT,
msg + " udev_device_new_from_syspath returned NULL");
ret = "";
}

udev_unref(udev);
}
else
VERBOSE(VB_IMPORTANT, "MediaMonitorUnix::GetDeviceFile udev_new failed");
LogPrint(VB_GENERAL, LOG_ALERT,
"MediaMonitorUnix::GetDeviceFile udev_new failed");
#else // HAVE_LIBUDEV
// Use udevadm info to determine the name
QStringList args;
args << "info" << "-q" << "name"
<< "-rp" << sysfs;

uint flags = kMSStdOut | kMSBuffered;
if( VERBOSE_LEVEL_CHECK(VB_MEDIA|VB_EXTRA) )
// TODO: rename to LOG_MASK_CHECK and LOG_LEVEL_CHECK
if( VERBOSE_LEVEL_CHECK(VB_MEDIA) && LogLevel <= LOG_DEBUG )
flags |= kMSStdErr;

// TODO: change this to a MythSystem on the stack?
MythSystem *udevinfo = new MythSystem("udevinfo", args, flags);
udevinfo->Run(4);
if( udevinfo->Wait() != GENERIC_EXIT_OK )
Expand All @@ -367,11 +376,11 @@ QString MediaMonitorUnix::GetDeviceFile(const QString &sysfs)
return ret;
}

if (VERBOSE_LEVEL_CHECK(VB_MEDIA|VB_EXTRA))
if( VERBOSE_LEVEL_CHECK(VB_MEDIA) && LogLevel <= LOG_DEBUG )
{
QTextStream estream(udevinfo->ReadAllErr());
while( !estream.atEnd() )
VERBOSE(VB_MEDIA+VB_EXTRA,
LogPrint(VB_MEDIA, LOG_DEBUG,
msg + " - udevadm info error...\n" + estream.readLine());
}

Expand All @@ -384,7 +393,7 @@ QString MediaMonitorUnix::GetDeviceFile(const QString &sysfs)
#endif // HAVE_LIBUDEV
#endif // linux

VERBOSE(VB_MEDIA, msg + "->'" + ret + "'");
LogPrint(VB_MEDIA, LOG_INFO, msg + "->'" + ret + "'");
return ret;
}
#endif // !CONFIG_QTDBUS
Expand Down Expand Up @@ -444,8 +453,8 @@ QStringList MediaMonitorUnix::GetCDROMBlockDevices(void)
}
#endif // linux

VERBOSE(VB_MEDIA+VB_EXTRA,
LOC + ":GetCDROMBlockDevices()->'" + l.join(", ") + "'");
LogPrint(VB_MEDIA, LOG_DEBUG,
LOC + ":GetCDROMBlockDevices()->'" + l.join(", ") + "'");
return l;
}

Expand Down Expand Up @@ -517,8 +526,8 @@ static void LookupModel(MythMediaDevice* device)
}
#endif

VERBOSE(VB_MEDIA+VB_EXTRA, QString("LookupModel '%1' -> '%2'").
arg(device->getRealDevice()).arg(desc) );
LogPrint(VB_MEDIA, LOG_DEBUG, QString("LookupModel '%1' -> '%2'")
.arg(device->getRealDevice()).arg(desc) );
device->setDeviceModel(desc.toAscii().constData());
}

Expand All @@ -529,7 +538,8 @@ bool MediaMonitorUnix::AddDevice(MythMediaDevice* pDevice)
{
if ( ! pDevice )
{
VERBOSE(VB_IMPORTANT, "Error - MediaMonitorUnix::AddDevice(null)");
LogPrint(VB_GENERAL, LOG_ALERT,
"Error - MediaMonitorUnix::AddDevice(null)");
return false;
}

Expand All @@ -540,7 +550,7 @@ bool MediaMonitorUnix::AddDevice(MythMediaDevice* pDevice)
QString path = pDevice->getDevicePath();
if (!path.length())
{
VERBOSE(VB_IMPORTANT,
LogPrint(VB_GENERAL, LOG_ALERT,
"MediaMonitorUnix::AddDevice() - empty device path.");
return false;
}
Expand Down Expand Up @@ -569,10 +579,11 @@ bool MediaMonitorUnix::AddDevice(MythMediaDevice* pDevice)

if (sb.st_rdev == new_rdev)
{
VERBOSE(VB_MEDIA, LOC + ":AddDevice() - not adding " + path
+ "\n "
"because it appears to be a duplicate of "
+ (*itr)->getDevicePath());
LogPrint(VB_MEDIA, LOG_INFO,
LOC + ":AddDevice() - not adding " + path +
"\n "
"because it appears to be a duplicate of " +
(*itr)->getDevicePath());
return false;
}
}
Expand All @@ -585,7 +596,7 @@ bool MediaMonitorUnix::AddDevice(MythMediaDevice* pDevice)
this, SLOT(mediaStatusChanged(MythMediaStatus, MythMediaDevice*)));
m_Devices.push_back( pDevice );
m_UseCount[pDevice] = 0;
VERBOSE(VB_MEDIA, LOC + ":AddDevice() - Added " + path);
LogPrint(VB_MEDIA, LOG_INFO, LOC + ":AddDevice() - Added " + path);

return true;
}
Expand All @@ -597,7 +608,9 @@ bool MediaMonitorUnix::AddDevice(struct fstab * mep)
return false;

QString devicePath( mep->fs_spec );
//VERBOSE(VB_GENERAL, "AddDevice - " + devicePath);
#if 0
LogPrint(VB_GENERAL, LOG_DEBUG, "AddDevice - " + devicePath);
#endif

MythMediaDevice* pDevice = NULL;
struct stat sbuf;
Expand Down Expand Up @@ -632,7 +645,9 @@ bool MediaMonitorUnix::AddDevice(struct fstab * mep)
strstr(mep->fs_vfstype, MNTTYPE_AUTO))
{
is_cdrom = true;
//VERBOSE(VB_GENERAL, "Device is a CDROM");
#if 0
LogPrint(VB_GENERAL, LOG_DEBUG, "Device is a CDROM");
#endif
}

if (!is_supermount)
Expand Down Expand Up @@ -686,7 +701,7 @@ bool MediaMonitorUnix::AddDevice(struct fstab * mep)
*/
void MediaMonitorUnix::deviceAdded( QDBusObjectPath o)
{
VERBOSE(VB_MEDIA, LOC + ":deviceAdded " + o.path());
LogPrint(VB_MEDIA, LOG_INFO, LOC + ":deviceAdded " + o.path());

// Don't add devices with partition tables, just the partitions
if (!DeviceProperty(o, "DeviceIsPartitionTable").toBool())
Expand All @@ -709,7 +724,7 @@ void MediaMonitorUnix::deviceAdded( QDBusObjectPath o)
*/
void MediaMonitorUnix::deviceRemoved( QDBusObjectPath o)
{
VERBOSE(VB_MEDIA, LOC + "deviceRemoved " + o.path());
LogPrint(VB_MEDIA, LOG_INFO, LOC + "deviceRemoved " + o.path());
#if 0 // This fails because the DeviceFile has just been deleted
QString dev = DeviceProperty(o, "DeviceFile");
if (!dev.isEmpty())
Expand Down Expand Up @@ -741,8 +756,9 @@ void MediaMonitorUnix::deviceRemoved( QDBusObjectPath o)
*/
bool MediaMonitorUnix::FindPartitions(const QString &dev, bool checkPartitions)
{
VERBOSE(VB_MEDIA+VB_EXTRA, LOC + ":FindPartitions(" + dev + QString(",%1").
arg(checkPartitions ? " true" : " false" ) + ")");
LogPrint(VB_MEDIA, LOG_DEBUG,
LOC + ":FindPartitions(" + dev +
QString(",%1").arg(checkPartitions ? " true" : " false" ) + ")");
MythMediaDevice* pDevice = NULL;

if (checkPartitions)
Expand Down Expand Up @@ -834,15 +850,15 @@ void MediaMonitorUnix::CheckDeviceNotifications(void)
if ((*it).startsWith("add"))
{
QString dev = (*it).section(' ', 1, 1);
VERBOSE(VB_MEDIA, "Udev add " + dev);
LogPrint(VB_MEDIA, LOG_INFO, "Udev add " + dev);

if (CheckRemovable(dev))
FindPartitions(dev, true);
}
else if ((*it).startsWith("remove"))
{
QString dev = (*it).section(' ', 2, 2);
VERBOSE(VB_MEDIA, "Udev remove " + dev);
LogPrint(VB_MEDIA, LOG_INFO, "Udev remove " + dev);
RemoveDevice(dev);
}
}
Expand Down
14 changes: 8 additions & 6 deletions mythtv/libs/libmyth/mediamonitor-windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MediaMonitorWindows::MediaMonitorWindows(QObject* par,

if (!media)
{
VERBOSE(VB_IMPORTANT,
LogPrint(VB_GENERAL, LOG_ALERT,
"Error. Couldn't create MythMediaDevice.");
return;
}
Expand All @@ -61,14 +61,15 @@ MediaMonitorWindows::MediaMonitorWindows(QObject* par,
AddDevice(media);
}

VERBOSE(VB_MEDIA, "Initial device list: " + listDevices());
LogPrint(VB_MEDIA, LOG_INFO, "Initial device list: " + listDevices());
}

bool MediaMonitorWindows::AddDevice(MythMediaDevice *pDevice)
{
if (!pDevice)
{
VERBOSE(VB_IMPORTANT, "Error - MediaMonitorWindows::AddDevice(null)");
LogPrint(VB_GENERAL, LOG_ALERT,
"Error - MediaMonitorWindows::AddDevice(null)");
return false;
}

Expand All @@ -82,9 +83,10 @@ bool MediaMonitorWindows::AddDevice(MythMediaDevice *pDevice)
{
if ((*itr)->getDevicePath() == path)
{
VERBOSE(VB_MEDIA, "MediamonitorWindows::AddDevice() -- " +
QString("Not adding '%1', it appears to be a duplicate.")
.arg(path));
LogPrint(VB_MEDIA, LOG_INFO,
"MediamonitorWindows::AddDevice() -- " +
QString("Not adding '%1', it appears to be a duplicate.")
.arg(path));

return false;
}
Expand Down
38 changes: 20 additions & 18 deletions mythtv/libs/libmyth/mythconfiggroups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,10 @@ void StackedConfigurationGroup::raise(Configurable* child)
}
}

VERBOSE(VB_IMPORTANT, QString("BUG: StackedConfigurationGroup::raise(): "
"unrecognized child 0x%1 on setting %2/%3")
.arg((uint64_t)child,0,16).arg(getName()).arg(getLabel()));
LogPrint(VB_GENERAL, LOG_ALERT,
QString("BUG: StackedConfigurationGroup::raise(): "
"unrecognized child 0x%1 on setting %2/%3")
.arg((uint64_t)child,0,16).arg(getName()).arg(getLabel()));
}

void StackedConfigurationGroup::Save(void)
Expand Down Expand Up @@ -565,7 +566,8 @@ void TriggeredConfigurationGroup::triggerChanged(const QString &value)

if (it == triggerMap.end())
{
VERBOSE(VB_IMPORTANT, QString("TriggeredConfigurationGroup::") +
LogPrint(VB_GENERAL, LOG_ALERT,
"TriggeredConfigurationGroup::" +
QString("triggerChanged(%1) Error:").arg(value) +
"Failed to locate value in triggerMap");
}
Expand All @@ -585,9 +587,10 @@ void TriggeredConfigurationGroup::SetVertical(bool vert)
{
if (configLayout)
{
VERBOSE(VB_IMPORTANT, "TriggeredConfigurationGroup::setVertical(): "
"Sorry, this must be called before any children are added "
"to the group.");
LogPrint(VB_GENERAL, LOG_ALERT,
"TriggeredConfigurationGroup::setVertical(): "
"Sorry, this must be called before any children are added "
"to the group.");
return;
}

Expand All @@ -599,19 +602,19 @@ void TriggeredConfigurationGroup::removeTarget(QString triggerValue)
ComboBoxSetting *combobox = dynamic_cast<ComboBoxSetting*>(trigger);
if (!combobox)
{
VERBOSE(VB_IMPORTANT,
"TriggeredConfigurationGroup::removeTarget(): "
"Failed to cast trigger to ComboBoxSetting -- aborting");
LogPrint(VB_GENERAL, LOG_ALERT,
"TriggeredConfigurationGroup::removeTarget(): "
"Failed to cast trigger to ComboBoxSetting -- aborting");
return;
}

QMap<QString,Configurable*>::iterator cit = triggerMap.find(triggerValue);
if (cit == triggerMap.end())
{
VERBOSE(VB_IMPORTANT,
QString("TriggeredConfigurationGroup::removeTarget(): "
LogPrint(VB_GENERAL, LOG_ALERT,
QString("TriggeredConfigurationGroup::removeTarget(): "
"Failed to find desired value(%1) -- aborting")
.arg(triggerValue));
.arg(triggerValue));
return;
}

Expand All @@ -629,11 +632,10 @@ void TriggeredConfigurationGroup::removeTarget(QString triggerValue)

if (!ok)
{
VERBOSE(VB_IMPORTANT,
QString(
"TriggeredConfigurationGroup::removeTarget(): "
"Failed to remove '%1' from combobox -- aborting")
.arg(triggerValue));
LogPrint(VB_GENERAL, LOG_ALERT,
QString("TriggeredConfigurationGroup::removeTarget(): "
"Failed to remove '%1' from combobox -- aborting")
.arg(triggerValue));
return;
}

Expand Down
107 changes: 56 additions & 51 deletions mythtv/libs/libmyth/mythcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static void exec_program_tv_cb(const QString &cmd)
"in-progress recordings from the delete menu");
}

VERBOSE(VB_IMPORTANT, QString("exec_program_tv: ") + label);
LogPrint(VB_GENERAL, LOG_ALERT, QString("exec_program_tv: ") + label);

ShowOkPopup(label);
}
Expand Down Expand Up @@ -353,7 +353,7 @@ bool MythContextPrivate::FindDatabase(const bool prompt, const bool noPrompt)
autoSelect = manualSelect = false; // so disable any further UPnP
else
if (failure.length())
VERBOSE(VB_IMPORTANT, failure);
LogPrint(VB_GENERAL, LOG_ALERT, failure);

failure = TestDBconnection();
if (failure.isEmpty())
Expand Down Expand Up @@ -413,27 +413,31 @@ bool MythContextPrivate::FindDatabase(const bool prompt, const bool noPrompt)
// line or the GUI depending on the application.
while (!failure.isEmpty())
{
VERBOSE(VB_IMPORTANT, QString("%1").arg(failure));
LogPrint(VB_GENERAL, LOG_ALERT, failure);
if (( manualSelect && ChooseBackend(failure)) ||
(!manualSelect && PromptForDatabaseParams(failure)))
{
failure = TestDBconnection();
if (failure.length())
VERBOSE(VB_IMPORTANT, QString("%1").arg(failure));
LogPrint(VB_GENERAL, LOG_ALERT, failure);
}
else
goto NoDBfound;
}

DBfound:
//VERBOSE(VB_GENERAL, "FindDatabase() - Success!");
#if 0
LogPrint(VB_GENERAL, LOG_DEBUG, "FindDatabase() - Success!");
#endif
StoreConnectionInfo();
EnableDBerrors();
ResetDatabase();
return true;

NoDBfound:
//VERBOSE(VB_GENERAL, "FindDatabase() - failed");
#if 0
LogPrint(VB_GENERAL, LOG_DEBUG, "FindDatabase() - failed");
#endif
return false;
}

Expand All @@ -454,15 +458,15 @@ void MythContextPrivate::LoadDatabaseSettings(void)
char localhostname[1024];
if (gethostname(localhostname, 1024))
{
VERBOSE(VB_IMPORTANT,
LogPrint(VB_GENERAL, LOG_ALERT,
"MCP: Error, could not determine host name." + ENO);
localhostname[0] = '\0';
}
hostname = localhostname;
VERBOSE(VB_IMPORTANT, "Empty LocalHostName.");
LogPrint(VB_GENERAL, LOG_ALERT, "Empty LocalHostName.");
}

VERBOSE(VB_GENERAL, QString("Using localhost value of %1")
LogPrint(VB_GENERAL, LOG_INFO, QString("Using localhost value of %1")
.arg(hostname));
gCoreContext->SetLocalHostname(hostname);
}
Expand All @@ -482,7 +486,8 @@ bool MythContextPrivate::PromptForDatabaseParams(const QString &error)
DatabaseSettings settings(m_DBhostCp);
accepted = (settings.exec() == QDialog::Accepted);
if (!accepted)
VERBOSE(VB_IMPORTANT, "User cancelled database configuration");
LogPrint(VB_GENERAL, LOG_ALERT,
"User cancelled database configuration");

EndTempWindow();
}
Expand Down Expand Up @@ -575,19 +580,20 @@ QString MythContextPrivate::TestDBconnection(void)
break;
}

VERBOSE(VB_GENERAL, QString("Trying to wake up host %1, attempt %2")
.arg(host).arg(attempt));
LogPrint(VB_GENERAL, LOG_INFO,
QString("Trying to wake up host %1, attempt %2")
.arg(host).arg(attempt));
myth_system(m_DBparams.wolCommand);

VERBOSE(VB_GENERAL,
QString("Waiting for %1 seconds").arg(wakeupTime));
LogPrint(VB_GENERAL, LOG_INFO,
QString("Waiting for %1 seconds").arg(wakeupTime));
sleep(m_DBparams.wolReconnect);
}

if (doPing)
{
VERBOSE(VB_GENERAL,
QString("Testing network connectivity to '%1'").arg(host));
LogPrint(VB_GENERAL, LOG_INFO,
QString("Testing network connectivity to '%1'").arg(host));
}

if (doPing && !ping(host, 3)) // Fail after trying for 3 seconds
Expand Down Expand Up @@ -688,7 +694,7 @@ int MythContextPrivate::ChooseBackend(const QString &error)
if (error.length())
ShowOkPopup(error);

VERBOSE(VB_GENERAL, "Putting up the UPnP backend chooser");
LogPrint(VB_GENERAL, LOG_INFO, "Putting up the UPnP backend chooser");

BackendSelection::prompt(&m_DBparams, m_pConfig);

Expand Down Expand Up @@ -728,7 +734,6 @@ int MythContextPrivate::UPnPautoconf(const int milliSeconds)
{
SSDPCacheEntries *backends = NULL;
int count;
QString loc = "UPnPautoconf() - ";
QTime timer;

SSDP::Instance()->PerformSearch( gBackendURI );
Expand All @@ -744,23 +749,24 @@ int MythContextPrivate::UPnPautoconf(const int milliSeconds)

if (!backends)
{
VERBOSE(VB_GENERAL, loc + "No UPnP backends found");
LogPrint(VB_GENERAL, LOG_INFO, "No UPnP backends found");
return 0;
}

count = backends->Count();
switch (count)
{
case 0:
VERBOSE(VB_IMPORTANT,
loc + "No UPnP backends found, but SSDP::Find() not NULL!");
LogPrint(VB_GENERAL, LOG_ALERT,
"No UPnP backends found, but SSDP::Find() not NULL!");
break;
case 1:
VERBOSE(VB_GENERAL, loc + "Found one UPnP backend");
LogPrint(VB_GENERAL, LOG_INFO, "Found one UPnP backend");
break;
default:
VERBOSE(VB_GENERAL,
(loc + "More than one UPnP backend found (%1)").arg(count));
LogPrint(VB_GENERAL, LOG_INFO,
QString("More than one UPnP backend found (%1)")
.arg(count));
}

if (count != 1)
Expand Down Expand Up @@ -799,13 +805,12 @@ bool MythContextPrivate::DefaultUPnP(QString &error)

if (USN.isEmpty())
{
VERBOSE(VB_UPNP, loc + "No default UPnP backend");
LogPrint(VB_UPNP, LOG_INFO, "No default UPnP backend");
return false;
}

VERBOSE(VB_UPNP, loc + "config.xml has default " +
QString("PIN '%1' and host USN: %2")
.arg(PIN).arg(USN));
LogPrint(VB_UPNP, LOG_INFO, "config.xml has default " +
QString("PIN '%1' and host USN: %2") .arg(PIN).arg(USN));

// ----------------------------------------------------------------------

Expand Down Expand Up @@ -868,24 +873,24 @@ bool MythContextPrivate::UPnPconnect(const DeviceLocation *backend,
QString URL = backend->m_sLocation;
MythXMLClient client(URL);

VERBOSE(VB_UPNP, loc + QString("Trying host at %1").arg(URL));
LogPrint(VB_UPNP, LOG_INFO, QString("Trying host at %1").arg(URL));
switch (client.GetConnectionInfo(PIN, &m_DBparams, error))
{
case UPnPResult_Success:
gCoreContext->GetDB()->SetDatabaseParams(m_DBparams);
VERBOSE(VB_UPNP,
loc + "Got database hostname: " + m_DBparams.dbHostName);
LogPrint(VB_UPNP, LOG_INFO,
"Got database hostname: " + m_DBparams.dbHostName);
return true;

case UPnPResult_ActionNotAuthorized:
// The stored PIN is probably not correct.
// We could prompt for the PIN and try again, but that needs a UI.
// Easier to fail for now, and put up the full UI selector later
VERBOSE(VB_UPNP, loc + error + ". Wrong PIN?");
LogPrint(VB_UPNP, LOG_ERR, "Wrong PIN?");
return false;

default:
VERBOSE(VB_UPNP, loc + error);
LogPrint(VB_UPNP, LOG_ERR, error);
break;
}

Expand All @@ -897,7 +902,7 @@ bool MythContextPrivate::UPnPconnect(const DeviceLocation *backend,
if (URL.isEmpty())
return false;

VERBOSE(VB_UPNP, "Trying default DB credentials at " + URL);
LogPrint(VB_UPNP, LOG_INFO, "Trying default DB credentials at " + URL);
m_DBparams.dbHostName = URL;

return true;
Expand Down Expand Up @@ -976,7 +981,7 @@ void MythContextPrivate::ShowVersionMismatchPopup(uint remote_version)
}
else
{
VERBOSE(VB_IMPORTANT, LOC_ERR + message);
LogPrint(VB_GENERAL, LOG_ERR, message);
qApp->exit(GENERIC_EXIT_SOCKET_ERROR);
}
}
Expand All @@ -1000,7 +1005,8 @@ MythContext::MythContext(const QString &binversion)
if (!WSAStarted) {
WSADATA wsadata;
int res = WSAStartup(MAKEWORD(2, 0), &wsadata);
VERBOSE(VB_SOCKET, QString("WSAStartup returned %1").arg(res));
LogPrint(VB_SOCKET, LOG_INFO,
QString("WSAStartup returned %1").arg(res));
}
#endif

Expand All @@ -1010,7 +1016,7 @@ MythContext::MythContext(const QString &binversion)

if (!gCoreContext || !gCoreContext->Init())
{
VERBOSE(VB_IMPORTANT, LOC_ERR + "Unable to allocate MythCoreContext");
LogPrint(VB_GENERAL, LOG_EMERG, "Unable to allocate MythCoreContext");
qApp->exit(GENERIC_EXIT_NO_MYTHCONTEXT);
}
}
Expand All @@ -1022,16 +1028,16 @@ bool MythContext::Init(const bool gui,
{
if (!d)
{
VERBOSE(VB_IMPORTANT, LOC_ERR + "Init() Out-of-memory");
LogPrint(VB_GENERAL, LOG_EMERG, "Init() Out-of-memory");
return false;
}

if (app_binary_version != MYTH_BINARY_VERSION)
{
VERBOSE(VB_GENERAL, QString("Application binary version (%1) does not "
"match libraries (%2)")
.arg(app_binary_version)
.arg(MYTH_BINARY_VERSION));
LogPrint(VB_GENERAL, LOG_EMERG,
QString("Application binary version (%1) does not "
"match libraries (%2)")
.arg(app_binary_version) .arg(MYTH_BINARY_VERSION));

QString warning = QObject::tr(
"This application is not compatible "
Expand All @@ -1041,7 +1047,7 @@ bool MythContext::Init(const bool gui,
d->TempMainWindow(false);
ShowOkPopup(warning);
}
VERBOSE(VB_IMPORTANT, warning);
LogPrint(VB_GENERAL, LOG_WARNING, warning);

return false;
}
Expand Down Expand Up @@ -1076,7 +1082,7 @@ bool MythContext::Init(const bool gui,
d->TempMainWindow(false);
ShowOkPopup(warning);
}
VERBOSE(VB_IMPORTANT, warning);
LogPrint(VB_GENERAL, LOG_WARNING, warning);

return false;
}
Expand All @@ -1094,10 +1100,8 @@ bool MythContext::Init(const bool gui,
MythContext::~MythContext()
{
if (QThreadPool::globalInstance()->activeThreadCount())
{
VERBOSE(VB_GENERAL,
"~MythContext waiting for threads to exit.");
}
LogPrint(VB_GENERAL, LOG_INFO, "Waiting for threads to exit.");

QThreadPool::globalInstance()->waitForDone();
logStop();

Expand All @@ -1118,9 +1122,10 @@ bool MythContext::TestPopupVersion(const QString &name,
"Plugin %1 is not compatible with the installed MythTV "
"libraries.");

VERBOSE(VB_GENERAL, QString("Plugin %1 (%2) binary version does not "
"match libraries (%3)")
.arg(name).arg(pluginversion).arg(libversion));
LogPrint(VB_GENERAL, LOG_EMERG,
QString("Plugin %1 (%2) binary version does not "
"match libraries (%3)")
.arg(name).arg(pluginversion).arg(libversion));

if (GetMythMainWindow() && !d->disablelibrarypopup)
ShowOkPopup(err.arg(name));
Expand Down
49 changes: 26 additions & 23 deletions mythtv/libs/libmyth/mythdialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ MythDialog::MythDialog(MythMainWindow *parent, const char *name, bool setsize)
setObjectName(name);
if (!parent)
{
VERBOSE(VB_IMPORTANT, "Trying to create a dialog without a parent.");
LogPrint(VB_GENERAL, LOG_ALERT,
"Trying to create a dialog without a parent.");
return;
}

Expand Down Expand Up @@ -118,9 +119,9 @@ void MythDialog::setResult(DialogCode r)
if ((r < kDialogCodeRejected) ||
((kDialogCodeAccepted < r) && (r < kDialogCodeListStart)))
{
VERBOSE(VB_IMPORTANT, QString(
"Programmer Error: MythDialog::setResult(%1) "
"called with invalid DialogCode").arg(r));
LogPrint(VB_GENERAL, LOG_ALERT,
QString("MythDialog::setResult(%1) "
"called with invalid DialogCode").arg(r));
}

rescode = r;
Expand All @@ -137,9 +138,9 @@ void MythDialog::AcceptItem(int i)
{
if (i < 0)
{
VERBOSE(VB_IMPORTANT,
QString("Programmer Error: MythDialog::AcceptItem(%1) "
"called with negative index").arg(i));
LogPrint(VB_GENERAL, LOG_ALERT,
QString("MythDialog::AcceptItem(%1) "
"called with negative index").arg(i));
reject();
return;
}
Expand All @@ -166,7 +167,8 @@ DialogCode MythDialog::exec(void)
{
if (in_loop)
{
VERBOSE(VB_IMPORTANT, "MythDialog::exec: Recursive call detected.");
LogPrint(VB_GENERAL, LOG_ALERT,
"MythDialog::exec: Recursive call detected.");
return kDialogCodeRejected;
}

Expand Down Expand Up @@ -697,8 +699,7 @@ void MythPopupBox::defaultButtonPressedHandler(void)
return;
}

VERBOSE(VB_IMPORTANT, "MythPopupBox::defaultButtonPressedHandler(void)"
"\n\t\t\tWe should never get here!");
LogPrint(VB_GENERAL, LOG_ALERT, "We should never get here!");
done(kDialogCodeRejected);
}

Expand Down Expand Up @@ -1189,10 +1190,10 @@ void MythThemedDialog::loadWindow(QDomElement &element)
}
else
{
VERBOSE(VB_IMPORTANT,
QString("MythThemedDialog::loadWindow(): Do not "
"understand DOM Element: '%1'. Ignoring.")
.arg(e.tagName()));
LogPrint(VB_GENERAL, LOG_ALERT,
QString("MythThemedDialog::loadWindow(): Do not "
"understand DOM Element: '%1'. Ignoring.")
.arg(e.tagName()));
}
}
}
Expand All @@ -1212,7 +1213,8 @@ void MythThemedDialog::parseContainer(QDomElement &element)
theme->parseContainer(element, name, a_context, area);
if (name.length() < 1)
{
VERBOSE(VB_IMPORTANT, "Failed to parse a container. Ignoring.");
LogPrint(VB_GENERAL, LOG_ALERT,
"Failed to parse a container. Ignoring.");
return;
}

Expand All @@ -1236,8 +1238,8 @@ void MythThemedDialog::parsePopup(QDomElement &element)
// theme doesn't know how to do this yet
//
element = element;
VERBOSE(VB_IMPORTANT,
"MythThemedDialog cannot parse popups yet - ignoring");
LogPrint(VB_GENERAL, LOG_ALERT,
"MythThemedDialog cannot parse popups yet - ignoring");
}

void MythThemedDialog::initForeground()
Expand Down Expand Up @@ -1300,7 +1302,7 @@ void MythThemedDialog::updateForeground(const QRect &r)
QRect rect_to_update = r;
if (r.width() == 0 || r.height() == 0)
{
VERBOSE(VB_IMPORTANT, ZeroSizedRect);
LogPrint(VB_GENERAL, LOG_ALERT, ZeroSizedRect);
rect_to_update = this->geometry();
}

Expand All @@ -1314,7 +1316,7 @@ void MythThemedDialog::ReallyUpdateForeground(const QRect &r)
QRect rect_to_update = r;
if (r.width() == 0 || r.height() == 0)
{
VERBOSE(VB_IMPORTANT, ZeroSizedRect);
LogPrint(VB_GENERAL, LOG_ALERT, ZeroSizedRect);
rect_to_update = this->geometry();
}

Expand Down Expand Up @@ -1367,8 +1369,9 @@ void MythThemedDialog::UpdateForegroundRect(const QRect &inv_rect)
// Debugging
//
#if 0
VERBOSE(VB_GENERAL, QString("A container called \"%1\" said its "
"area is %2,%3 to %4,%5")
LogPrint(VB_GENERAL, LOG_DEBUG,
QString("A container called \"%1\" said its "
"area is %2,%3 to %4,%5")
.arg(looper->GetName())
.arg(container_area.left())
.arg(container_area.top())
Expand Down Expand Up @@ -1511,8 +1514,8 @@ void MythThemedDialog::activateCurrent()
}
else
{
VERBOSE(VB_IMPORTANT, "MythThemedDialog::activateCurrent() - "
"there is no current widget!");
LogPrint(VB_GENERAL, LOG_ALERT, "MythThemedDialog::activateCurrent() - "
"there is no current widget!");
}
}

Expand Down
103 changes: 59 additions & 44 deletions mythtv/libs/libmyth/mythmediamonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ void MediaMonitor::SetCDSpeed(const char *device, int speed)
delete cd;
}

VERBOSE(VB_MEDIA, QString("MediaMonitor::setSpeed(%1) "
"- Cannot find/create CDROM?") + device);
LogPrint(VB_MEDIA, LOG_INFO,
QString("MediaMonitor::setSpeed(%1) - Cannot find/create CDROM?")
.arg(device));
}

// When ejecting one of multiple devices, present a nice name to the user
Expand Down Expand Up @@ -159,15 +160,17 @@ MythMediaDevice * MediaMonitor::selectDrivePopup(const QString label,

if (drives.count() == 0)
{
VERBOSE(VB_MEDIA, "MediaMonitor::selectDrivePopup("
+ label + ") - No suitable devices");
LogPrint(VB_MEDIA, LOG_INFO,
"MediaMonitor::selectDrivePopup(" + label +
") - No suitable devices");
return NULL;
}

if (drives.count() == 1)
{
VERBOSE(VB_MEDIA, "MediaMonitor::selectDrivePopup("
+ label + ") - One suitable device");
LogPrint(VB_MEDIA, LOG_INFO,
"MediaMonitor::selectDrivePopup(" + label +
") - One suitable device");
return drives.front();
}

Expand Down Expand Up @@ -230,8 +233,8 @@ void MediaMonitor::AttemptEject(MythMediaDevice *device)

if (device->getStatus() == MEDIASTAT_OPEN)
{
VERBOSE(VB_MEDIA,
QString("Disk %1's tray is OPEN. Closing tray").arg(dev));
LogPrint(VB_MEDIA, LOG_INFO,
QString("Disk %1's tray is OPEN. Closing tray").arg(dev));

if (device->eject(false) != MEDIAERR_OK)
{
Expand All @@ -246,7 +249,8 @@ void MediaMonitor::AttemptEject(MythMediaDevice *device)

if (device->isMounted())
{
VERBOSE(VB_MEDIA, QString("Disk %1 is mounted? Unmounting").arg(dev));
LogPrint(VB_MEDIA, LOG_INFO,
QString("Disk %1 is mounted? Unmounting").arg(dev));
device->unmount();

if (device->isMounted())
Expand All @@ -256,7 +260,8 @@ void MediaMonitor::AttemptEject(MythMediaDevice *device)
}
}

VERBOSE(VB_MEDIA, QString("Unlocking disk %1, then eject()ing").arg(dev));
LogPrint(VB_MEDIA, LOG_INFO,
QString("Unlocking disk %1, then ejecting").arg(dev));
device->unlock();

MythMediaError err = device->eject();
Expand Down Expand Up @@ -297,15 +302,16 @@ MediaMonitor::MediaMonitor(QObject* par, unsigned long interval,
m_IgnoreList = QStringList(); // Force empty list

if (m_StartThread)
VERBOSE(VB_MEDIA, "Creating MediaMonitor");
LogPrint(VB_MEDIA, LOG_NOTICE, "Creating MediaMonitor");
else
#ifdef USING_DARWIN_DA
VERBOSE(VB_MEDIA, "MediaMonitor is disabled. Eject will not work");
LogPrint(VB_MEDIA, LOG_INFO,
"MediaMonitor is disabled. Eject will not work");
#else
VERBOSE(VB_MEDIA,
"Creating inactive MediaMonitor and static device list");
LogPrint(VB_MEDIA, LOG_INFO,
"Creating inactive MediaMonitor and static device list");
#endif
VERBOSE(VB_MEDIA, "IgnoreDevices=" + ignore);
LogPrint(VB_MEDIA, LOG_INFO, "IgnoreDevices=" + ignore);

// If any of IgnoreDevices are symlinks, also add the real device
QStringList::Iterator dev;
Expand All @@ -319,8 +325,9 @@ MediaMonitor::MediaMonitor(QObject* par, unsigned long interval,

if (m_IgnoreList.filter(target).isEmpty())
{
VERBOSE(VB_MEDIA, "Also ignoring " + target +
" (symlinked from " + *dev + ").");
LogPrint(VB_MEDIA, LOG_INFO,
"Also ignoring " + target + " (symlinked from " +
*dev + ").");
m_IgnoreList += target;
}
}
Expand Down Expand Up @@ -413,7 +420,7 @@ void MediaMonitor::StartMonitoring(void)

qRegisterMetaType<MythMediaStatus>("MythMediaStatus");

VERBOSE(VB_MEDIA, "Starting MediaMonitor");
LogPrint(VB_MEDIA, LOG_NOTICE, "Starting MediaMonitor");
m_Active = true;
m_Thread->start();
}
Expand All @@ -427,7 +434,7 @@ void MediaMonitor::StopMonitoring(void)
if (!m_Active)
return;

VERBOSE(VB_MEDIA, "Stopping MediaMonitor");
LogPrint(VB_MEDIA, LOG_NOTICE, "Stopping MediaMonitor");
m_Active = false;
m_Thread->wait();
}
Expand Down Expand Up @@ -527,7 +534,8 @@ QString MediaMonitor::GetMountPath(const QString& devPath)
if (pMedia && pMedia->findMountPath())
mountPath = pMedia->getMountPath();
else
VERBOSE(VB_MEDIA, "MediaMonitor::GetMountPath() - failed");
LogPrint(VB_MEDIA, LOG_INFO,
"MediaMonitor::GetMountPath() - failed");
// need some way to delete the media device.
}
}
Expand Down Expand Up @@ -580,8 +588,9 @@ QList<MythMediaDevice*> MediaMonitor::GetMedias(MythMediaType mediatype)
void MediaMonitor::MonitorRegisterExtensions(uint mediatype,
const QString &extensions)
{
VERBOSE(VB_IMPORTANT, QString("MonitorRegisterExtensions(0x%1, %2)")
.arg(mediatype, 0, 16).arg(extensions));
LogPrint(VB_GENERAL, LOG_DEBUG,
QString("MonitorRegisterExtensions(0x%1, %2)")
.arg(mediatype, 0, 16).arg(extensions));

QList<MythMediaDevice*>::iterator it = m_Devices.begin();
for (; it != m_Devices.end(); ++it)
Expand All @@ -607,8 +616,9 @@ void MediaMonitor::RegisterMediaHandler(const QString &destination,
if (extensions.length())
msg += QString(", ext(%1)").arg(extensions);

VERBOSE(VB_MEDIA, "Registering '" + destination +
"'\n as a media handler for " + msg);
LogPrint(VB_MEDIA, LOG_INFO,
"Registering '" + destination + "' as a media handler for " +
msg);

m_handlerMap[destination] = mhd;

Expand All @@ -617,8 +627,8 @@ void MediaMonitor::RegisterMediaHandler(const QString &destination,
}
else
{
VERBOSE(VB_GENERAL,
destination + " is already registered as a media handler.");
LogPrint(VB_GENERAL, LOG_INFO,
destination + " is already registered as a media handler.");
}
}

Expand All @@ -638,15 +648,16 @@ void MediaMonitor::JumpToMediaHandler(MythMediaDevice* pMedia)
{
if (((*itr).MythMediaType & (int)pMedia->getMediaType()))
{
VERBOSE(VB_IMPORTANT, "Found a handler - '" + itr.key() + "'");
LogPrint(VB_GENERAL, LOG_NOTICE,
"Found a handler - '" + itr.key() + "'");
handlers.append(*itr);
}
itr++;
}

if (handlers.empty())
{
VERBOSE(VB_MEDIA, "No media handler found for event type");
LogPrint(VB_MEDIA, LOG_INFO, "No media handler found for event type");
return;
}

Expand Down Expand Up @@ -683,7 +694,7 @@ void MediaMonitor::mediaStatusChanged(MythMediaStatus oldStatus,
// Should we ValidateAndLock() first?
QEvent *e = new MythMediaEvent(stat, pMedia);

VERBOSE(VB_MEDIA, "Posting MediaEvent" + msg);
LogPrint(VB_MEDIA, LOG_INFO, "Posting MediaEvent" + msg);

// sendEvent() is needed here - it waits for the event to be used.
// postEvent() would result in pDevice's media type changing
Expand All @@ -693,7 +704,8 @@ void MediaMonitor::mediaStatusChanged(MythMediaStatus oldStatus,
delete e;
}
else
VERBOSE(VB_MEDIA, "Media status changed, but not sending event" + msg);
LogPrint(VB_MEDIA, LOG_INFO,
"Media status changed, but not sending event" + msg);


if (stat == MEDIASTAT_OPEN || stat == MEDIASTAT_NODISK
Expand All @@ -712,15 +724,18 @@ bool MediaMonitor::shouldIgnore(const MythMediaDevice* device)
m_IgnoreList.contains(device->getRealDevice())||
m_IgnoreList.contains(device->getDevicePath()) )
{
VERBOSE(VB_MEDIA, "Ignoring device: " + device->getDevicePath());
LogPrint(VB_MEDIA, LOG_INFO,
"Ignoring device: " + device->getDevicePath());
return true;
}
#if 0
else
{
VERBOSE(VB_MEDIA, "Not ignoring: " + device->getDevicePath()
+ " / " + device->getMountPath());
VERBOSE(VB_MEDIA, "Paths not in: " + m_IgnoreList.join(", "));
LogPrint(VB_MEDIA, LOG_DEBUG,
"Not ignoring: " + device->getDevicePath() + " / " +
device->getMountPath());
LogPrint(VB_MEDIA, LOG_DEBUG,
"Paths not in: " + m_IgnoreList.join(", "));
}
#endif

Expand All @@ -739,8 +754,8 @@ bool MediaMonitor::eventFilter(QObject *obj, QEvent *event)

if (!pDev)
{
VERBOSE(VB_IMPORTANT,
"MediaMonitor::eventFilter() got a bad media event?");
LogPrint(VB_GENERAL, LOG_ALERT,
"MediaMonitor::eventFilter() got a bad media event?");
return true;
}

Expand Down Expand Up @@ -785,9 +800,9 @@ QString MediaMonitor::defaultDevice(QString dbSetting,
{
QString device = gCoreContext->GetSetting(dbSetting);

VERBOSE(VB_MEDIA+VB_EXTRA,
QString("MediaMonitor::defaultDevice(%1,..,%2) dbSetting='%3'")
.arg(dbSetting).arg(hardCodedDefault).arg(device));
LogPrint(VB_MEDIA, LOG_DEBUG,
QString("MediaMonitor::defaultDevice(%1,..,%2) dbSetting='%3'")
.arg(dbSetting).arg(hardCodedDefault).arg(device));

// No settings database defaults? Try to choose one:
if (device.isEmpty() || device == "default")
Expand All @@ -812,8 +827,8 @@ QString MediaMonitor::defaultDevice(QString dbSetting,
}
}

VERBOSE(VB_MEDIA+VB_EXTRA,
"MediaMonitor::defaultDevice() returning " + device);
LogPrint(VB_MEDIA, LOG_DEBUG,
"MediaMonitor::defaultDevice() returning " + device);
return device;
}

Expand Down Expand Up @@ -909,12 +924,12 @@ void MediaMonitor::ejectOpticalDisc()
mon->ChooseAndEjectMedia();
else
{
VERBOSE(VB_MEDIA, "CD/DVD Monitor isn't enabled.");
LogPrint(VB_MEDIA, LOG_INFO, "CD/DVD Monitor isn't enabled.");
#ifdef __linux__
VERBOSE(VB_MEDIA, "Trying Linux 'eject -T' command");
LogPrint(VB_MEDIA, LOG_INFO, "Trying Linux 'eject -T' command");
myth_system("eject -T");
#elif CONFIG_DARWIN
VERBOSE(VB_MEDIA, "Trying 'disktool -e disk1");
LogPrint(VB_MEDIA, LOG_INFO, "Trying 'disktool -e disk1");
myth_system("disktool -e disk1");
#endif
}
Expand Down
29 changes: 15 additions & 14 deletions mythtv/libs/libmyth/mythplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int MythPlugin::init(const char *libversion)
error_msg = dlerror();
}

VERBOSE(VB_IMPORTANT, QString("MythPlugin::init() dlerror: %1")
LogPrint(VB_GENERAL, LOG_EMERG, QString("MythPlugin::init() dlerror: %1")
.arg(error_msg));

return -1;
Expand Down Expand Up @@ -144,7 +144,7 @@ MythPluginManager::MythPluginManager()

QStringList libraries = filterDir.entryList();
if (libraries.isEmpty())
VERBOSE(VB_GENERAL,
LogPrint(VB_GENERAL, LOG_WARNING,
"No libraries in plugins directory " + filterDir.path());

for (QStringList::iterator i = libraries.begin(); i != libraries.end();
Expand All @@ -160,7 +160,8 @@ MythPluginManager::MythPluginManager()
}
}
else
VERBOSE(VB_GENERAL, "No plugins directory " + filterDir.path());
LogPrint(VB_GENERAL, LOG_WARNING,
"No plugins directory " + filterDir.path());

gContext->SetDisableLibraryPopup(false);

Expand All @@ -186,8 +187,8 @@ bool MythPluginManager::init_plugin(const QString &plugname)
{
delete m_dict[newname];
m_dict.remove(newname);
VERBOSE(VB_IMPORTANT, QString("Unable to initialize plugin '%1'.")
.arg(plugname));
LogPrint(VB_GENERAL, LOG_ERR,
QString("Unable to initialize plugin '%1'.") .arg(plugname));
return false;
}

Expand All @@ -214,9 +215,9 @@ bool MythPluginManager::run_plugin(const QString &plugname)

if (!m_dict[newname] && !init_plugin(plugname))
{
VERBOSE(VB_IMPORTANT,
QString("Unable to run plugin '%1': not initialized")
.arg(plugname));
LogPrint(VB_GENERAL, LOG_ALERT,
QString("Unable to run plugin '%1': not initialized")
.arg(plugname));
return true;
}

Expand All @@ -232,9 +233,9 @@ bool MythPluginManager::config_plugin(const QString &plugname)

if (!m_dict[newname] && !init_plugin(plugname))
{
VERBOSE(VB_IMPORTANT,
QString("Unable to configure plugin '%1': not initialized")
.arg(plugname));
LogPrint(VB_GENERAL, LOG_ALERT,
QString("Unable to configure plugin '%1': not initialized")
.arg(plugname));
return true;
}

Expand All @@ -249,9 +250,9 @@ bool MythPluginManager::destroy_plugin(const QString &plugname)

if (!m_dict[newname] && !init_plugin(plugname))
{
VERBOSE(VB_IMPORTANT,
QString("Unable to destroy plugin '%1': not initialized")
.arg(plugname));
LogPrint(VB_GENERAL, LOG_ALERT,
QString("Unable to destroy plugin '%1': not initialized")
.arg(plugname));
return false;
}

Expand Down
9 changes: 5 additions & 4 deletions mythtv/libs/libmyth/mythrssmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ void RSSManager::doUpdate()
for (RSSSite::rssList::iterator i = m_sites.begin();
i != m_sites.end(); ++i)
{
VERBOSE(VB_GENERAL, LOC + QString("Updating RSS Feed %1")
.arg((*i)->GetTitle()));
LogPrint(VB_GENERAL, LOG_INFO,
QString("Updating RSS Feed %1") .arg((*i)->GetTitle()));

connect(*i, SIGNAL(finished(RSSSite*)),
this, SLOT(slotRSSRetrieved(RSSSite*)));
Expand Down Expand Up @@ -220,7 +220,8 @@ void RSSSite::process(void)

if (!domDoc.setContent(m_data, true))
{
VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to set content from downloaded XML");
LogPrint(VB_GENERAL, LOG_ERR,
"Failed to set content from downloaded XML");
return;
}

Expand Down Expand Up @@ -256,7 +257,7 @@ void RSSSite::process(void)
}
else
{
VERBOSE(VB_IMPORTANT, LOC_ERR + "Data is not valid RSS-feed");
LogPrint(VB_GENERAL, LOG_ERR, "Data is not valid RSS-feed");
emit finished(this);
}
}
22 changes: 11 additions & 11 deletions mythtv/libs/libmyth/mythwidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,8 @@ void MythRemoteLineEdit::startCycle(QString current_choice, QString set)
{
if (active_cycle)
{
VERBOSE(VB_IMPORTANT, "MythRemoteLineEdit, Programmer Error: "
"startCycle() called, but edit is already in a cycle.");
LogPrint(VB_GENERAL, LOG_ALERT,
"startCycle() called, but edit is already in a cycle.");
return;
}

Expand Down Expand Up @@ -746,10 +746,10 @@ void MythRemoteLineEdit::updateCycle(QString current_choice, QString set)
int length = set.length();
if (index < 0 || index > length)
{
VERBOSE(VB_IMPORTANT,
QString("MythRemoteLineEdit passed a choice of \"%1"
"\" which is not in set \"%2"
"\"").arg(current_choice).arg(set));
LogPrint(VB_GENERAL, LOG_ALERT,
QString("MythRemoteLineEdit passed a choice of \"%1"
"\" which is not in set \"%2\"")
.arg(current_choice).arg(set));
setText("????");
return;
}
Expand Down Expand Up @@ -1008,11 +1008,11 @@ void MythRemoteLineEdit::setCycleTime(float desired_interval)
{
if (desired_interval < 0.5 || desired_interval > 10.0)
{
VERBOSE(VB_IMPORTANT, QString("MythRemoteLineEdit, Programmer Error, ")+
QString("cycle interval of %1 milliseconds ")
.arg((int) (desired_interval * 1000)) +
"\n\t\t\tis outside of the allowed range of "
"500 to 10,000 milliseconds");
LogPrint(VB_GENERAL, LOG_ALERT,
QString("cycle interval of %1 milliseconds ")
.arg((int) (desired_interval * 1000)) +
"\n\t\t\tis outside of the allowed range of "
"500 to 10,000 milliseconds");
return;
}

Expand Down
42 changes: 25 additions & 17 deletions mythtv/libs/libmyth/netgrabbermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ void GrabberScript::run()
uint status = getTree.Wait();

if( status == GENERIC_EXIT_CMD_NOT_FOUND )
VERBOSE(VB_IMPORTANT, LOC + QString("Internet Content Source %1 "
"cannot run, file missing.").arg(m_title));
LogPrint(VB_GENERAL, LOG_CRIT,
QString("Internet Content Source %1 cannot run, file missing.")
.arg(m_title));
else if( status == GENERIC_EXIT_OK )
{
VERBOSE(VB_IMPORTANT, LOC + QString("Internet Content Source %1 "
"completed download, beginning processing...").arg(m_title));
LogPrint(VB_GENERAL, LOG_INFO,
QString("Internet Content Source %1 completed download, "
"beginning processing...").arg(m_title));

QByteArray result = getTree.ReadAll();

Expand All @@ -78,12 +80,14 @@ void GrabberScript::run()
channel = channel.nextSiblingElement("channel");
}
markTreeUpdated(this, QDateTime::currentDateTime());
VERBOSE(VB_IMPORTANT, LOC + QString("Internet Content Source %1 "
"completed processing, marking as updated.").arg(m_title));
LogPrint(VB_GENERAL, LOG_INFO,
QString("Internet Content Source %1 completed processing, "
"marking as updated.").arg(m_title));
}
else
VERBOSE(VB_IMPORTANT, LOC_ERR + QString("Internet Content Source "
"%1 crashed while grabbing tree.").arg(m_title));
LogPrint(VB_GENERAL, LOG_ERR,
QString("Internet Content Source %1 crashed while grabbing "
"tree.").arg(m_title));

emit finished();
threadDeregister();
Expand Down Expand Up @@ -224,8 +228,9 @@ void GrabberDownloadThread::run()
GrabberScript *script = m_scripts.takeFirst();
if (script && (needsUpdate(script, updateFreq) || m_refreshAll))
{
VERBOSE(VB_IMPORTANT, LOC + QString("Internet Content Source %1 Updating...")
.arg(script->GetTitle()));
LogPrint(VB_GENERAL, LOG_INFO,
QString("Internet Content Source %1 Updating...")
.arg(script->GetTitle()));
script->run();
}
delete script;
Expand Down Expand Up @@ -256,11 +261,13 @@ void Search::executeSearch(const QString &script, const QString &query, uint pag
{
resetSearch();

VERBOSE(VB_IMPORTANT, "Search::executeSearch");
LogPrint(VB_GENERAL, LOG_DEBUG, "Search::executeSearch");
m_searchProcess = new MythSystem();

connect(m_searchProcess, SIGNAL(finished()), this, SLOT(slotProcessSearchExit()));
connect(m_searchProcess, SIGNAL(error(uint)), this, SLOT(slotProcessSearchExit(uint)));
connect(m_searchProcess, SIGNAL(finished()),
this, SLOT(slotProcessSearchExit()));
connect(m_searchProcess, SIGNAL(error(uint)),
this, SLOT(slotProcessSearchExit(uint)));

QString cmd = script;

Expand All @@ -276,8 +283,8 @@ VERBOSE(VB_IMPORTANT, "Search::executeSearch");
QString term = query;
args.append(ShellEscape(term));

VERBOSE(VB_GENERAL|VB_EXTRA, LOC + QString("Internet Search Query: %1 %2")
.arg(cmd).arg(args.join(" ")));
LogPrint(VB_GENERAL, LOG_DEBUG, QString("Internet Search Query: %1 %2")
.arg(cmd).arg(args.join(" ")));

uint flags = kMSRunShell | kMSStdOut | kMSBuffered | kMSRunBackground;
m_searchProcess->SetCommand(cmd, args, flags);
Expand Down Expand Up @@ -351,7 +358,7 @@ void Search::slotProcessSearchExit(uint exitcode)
{
if (exitcode == GENERIC_EXIT_TIMEOUT)
{
VERBOSE(VB_GENERAL|VB_EXTRA, LOC_ERR + "Internet Search Timeout");
LogPrint(VB_GENERAL, LOG_WARNING, "Internet Search Timeout");

if (m_searchProcess)
{
Expand All @@ -369,7 +376,8 @@ void Search::slotProcessSearchExit(uint exitcode)
}
else
{
VERBOSE(VB_GENERAL|VB_EXTRA, LOC_ERR + "Internet Search Successfully Completed");
LogPrint(VB_GENERAL, LOG_INFO,
"Internet Search Successfully Completed");

m_data = m_searchProcess->ReadAll();
m_document.setContent(m_data, true);
Expand Down
95 changes: 50 additions & 45 deletions mythtv/libs/libmyth/programinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ void ProgramInfo::ToStringList(QStringList &list) const

#define NEXT_STR() do { if (it == listend) \
{ \
VERBOSE(VB_IMPORTANT, listerror); \
LogPrint(VB_GENERAL, LOG_ERR, listerror); \
clear(); \
return false; \
} \
Expand Down Expand Up @@ -1657,9 +1657,9 @@ bool ProgramInfo::LoadProgramFromRecorded(
{
if (is_reload)
{
VERBOSE(VB_FILE, LOC +
QString("Updated pathname '%1':'%2' -> '%3'")
.arg(pathname).arg(GetBasename()).arg(new_basename));
LogPrint(VB_FILE, LOG_INFO,
QString("Updated pathname '%1':'%2' -> '%3'")
.arg(pathname).arg(GetBasename()).arg(new_basename));
}
SetPathname(new_basename);
}
Expand Down Expand Up @@ -1910,10 +1910,10 @@ void ProgramInfo::SetAvailableStatus(
{
if (status != availableStatus)
{
VERBOSE(VB_GUI, toString(kTitleSubtitle) +
QString(": %1 -> %2")
.arg(::toString((AvailableStatusType)availableStatus))
.arg(::toString(status)));
LogPrint(VB_GUI, LOG_INFO,
toString(kTitleSubtitle) + QString(": %1 -> %2")
.arg(::toString((AvailableStatusType)availableStatus))
.arg(::toString(status)));
}
availableStatus = status;
}
Expand Down Expand Up @@ -1976,9 +1976,9 @@ QString ProgramInfo::QueryBasename(void) const
}
else
{
VERBOSE(VB_IMPORTANT, QString("QueryBasename found no entry "
"for %1 @ %2")
.arg(chanid).arg(recstartts.toString(Qt::ISODate)));
LogPrint(VB_GENERAL, LOG_INFO,
QString("QueryBasename found no entry for %1 @ %2")
.arg(chanid).arg(recstartts.toString(Qt::ISODate)));
}

return QString();
Expand Down Expand Up @@ -2038,20 +2038,24 @@ QString ProgramInfo::GetPlaybackURL(
{
// Check to see if the file exists locally
StorageGroup sgroup(storagegroup);
//VERBOSE(VB_FILE, LOC +QString("GetPlaybackURL: CHECKING SG : %1 : ").arg(tmpURL));
#if 0
LogPrint(VB_FILE, LOG_DEBUG,
QString("GetPlaybackURL: CHECKING SG : %1 : ").arg(tmpURL));
#endif
tmpURL = sgroup.FindFile(basename);

if (!tmpURL.isEmpty())
{
VERBOSE(VB_FILE, LOC +
QString("GetPlaybackURL: File is local: '%1'").arg(tmpURL));
LogPrint(VB_FILE, LOG_INFO,
QString("GetPlaybackURL: File is local: '%1'")
.arg(tmpURL));
return tmpURL;
}
else if (hostname == gCoreContext->GetHostName())
{
VERBOSE(VB_IMPORTANT, LOC_ERR +
QString("GetPlaybackURL: '%1' should be local, but it can "
"not be found.").arg(basename));
LogPrint(VB_GENERAL, LOG_ERR,
QString("GetPlaybackURL: '%1' should be local, but it can "
"not be found.").arg(basename));
// Note do not preceed with "/" that will cause existing code
// to look for a local file with this name...
return QString("GetPlaybackURL/UNABLE/TO/FIND/LOCAL/FILE/ON/%1/%2")
Expand All @@ -2068,8 +2072,8 @@ QString ProgramInfo::GetPlaybackURL(
gCoreContext->GetSetting("MasterServerPort").toInt(),
basename);

VERBOSE(VB_FILE, LOC +
QString("GetPlaybackURL: Found @ '%1'").arg(tmpURL));
LogPrint(VB_FILE, LOG_INFO,
QString("GetPlaybackURL: Found @ '%1'").arg(tmpURL));
return tmpURL;
}

Expand All @@ -2078,8 +2082,9 @@ QString ProgramInfo::GetPlaybackURL(
gCoreContext->GetSettingOnHost("BackendServerPort", hostname).toInt(),
basename);

VERBOSE(VB_FILE, LOC + QString("GetPlaybackURL: Using default of: '%1'")
.arg(tmpURL));
LogPrint(VB_FILE, LOG_INFO,
QString("GetPlaybackURL: Using default of: '%1'")
.arg(tmpURL));

return tmpURL;
}
Expand Down Expand Up @@ -3547,8 +3552,8 @@ QString ProgramInfo::ChannelText(const QString &format) const
void ProgramInfo::UpdateInUseMark(bool force)
{
#ifdef DEBUG_IN_USE
VERBOSE(VB_IMPORTANT, LOC + QString("UpdateInUseMark(%1) '%2'")
.arg(force?"force":"no force").arg(inUseForWhat));
LogPrint(VB_GENERAL, LOG_DEBUG, QString("UpdateInUseMark(%1) '%2'")
.arg(force?"force":"no force").arg(inUseForWhat));
#endif

if (!IsRecording())
Expand Down Expand Up @@ -3710,15 +3715,15 @@ void ProgramInfo::MarkAsInUse(bool inuse, QString usedFor)
#ifdef DEBUG_IN_USE
if (!inUseForWhat.isEmpty())
{
VERBOSE(VB_IMPORTANT,
LOC + QString("MarkAsInUse(true, '%1'->'%2')")
.arg(inUseForWhat).arg(usedFor) +
" -- use has changed");
LogPrint(VB_GENERAL, LOG_INFO,
QString("MarkAsInUse(true, '%1'->'%2')")
.arg(inUseForWhat).arg(usedFor) +
" -- use has changed");
}
else
{
VERBOSE(VB_IMPORTANT, LOC +
QString("MarkAsInUse(true, ''->'%1')").arg(usedFor));
LogPrint(VB_GENERAL, LOG_INFO,
QString("MarkAsInUse(true, ''->'%1')").arg(usedFor));
}
#endif // DEBUG_IN_USE

Expand All @@ -3729,26 +3734,26 @@ void ProgramInfo::MarkAsInUse(bool inuse, QString usedFor)
QString oldInUseForWhat = inUseForWhat;
inUseForWhat = QString("%1 [%2]")
.arg(QObject::tr("Unknown")).arg(getpid());
VERBOSE(VB_IMPORTANT, LOC_WARN +
QString("MarkAsInUse(true, ''->'%1')").arg(inUseForWhat) +
" -- use was not explicitly set");
LogPrint(VB_GENERAL, LOG_WARNING,
QString("MarkAsInUse(true, ''->'%1')").arg(inUseForWhat) +
" -- use was not explicitly set");
}

notifyOfChange = true;
}

if (!inuse && !inUseForWhat.isEmpty() && usedFor != inUseForWhat)
{
VERBOSE(VB_IMPORTANT, LOC_WARN +
QString("MarkAsInUse(false, '%1'->'%2')")
.arg(inUseForWhat).arg(usedFor) +
" -- use has changed since first setting as in use.");
LogPrint(VB_GENERAL, LOG_WARNING,
QString("MarkAsInUse(false, '%1'->'%2')")
.arg(inUseForWhat).arg(usedFor) +
" -- use has changed since first setting as in use.");
}
#ifdef DEBUG_IN_USE
else if (!inuse)
{
VERBOSE(VB_IMPORTANT, LOC + QString("MarkAsInUse(false, '%1')")
.arg(inUseForWhat));
LogPrint(VB_GENERAL, LOG_DEBUG, QString("MarkAsInUse(false, '%1')")
.arg(inUseForWhat));
}
#endif // DEBUG_IN_USE

Expand All @@ -3757,8 +3762,8 @@ void ProgramInfo::MarkAsInUse(bool inuse, QString usedFor)

if (!inuse && inUseForWhat.isEmpty())
{
VERBOSE(VB_GENERAL, LOC_WARN +
"MarkAsInUse requires a key to delete in use mark");
LogPrint(VB_GENERAL, LOG_WARNING,
"MarkAsInUse requires a key to delete in use mark");
return; // can't delete if we don't have a key
}

Expand Down Expand Up @@ -3807,7 +3812,7 @@ void ProgramInfo::MarkAsInUse(bool inuse, QString usedFor)
}
else if (!query.next())
{
VERBOSE(VB_IMPORTANT, LOC_ERR + "MarkAsInUse -- select query failed");
LogPrint(VB_GENERAL, LOG_ERR, "MarkAsInUse -- select query failed");
}
else if (query.value(0).toUInt())
{
Expand Down Expand Up @@ -4115,8 +4120,8 @@ QStringList ProgramInfo::LoadFromScheduler(
QStringList slist;
if (gCoreContext->IsBackend())
{
VERBOSE(VB_IMPORTANT,
"LoadFromScheduler(): Error, called from backend.");
LogPrint(VB_GENERAL, LOG_ALERT,
"LoadFromScheduler(): Error, called from backend.");
return slist;
}

Expand All @@ -4127,8 +4132,8 @@ QStringList ProgramInfo::LoadFromScheduler(

if (!gCoreContext->SendReceiveStringList(slist) || slist.size() < 2)
{
VERBOSE(VB_IMPORTANT,
"LoadFromScheduler(): Error querying master.");
LogPrint(VB_GENERAL, LOG_ALERT,
"LoadFromScheduler(): Error querying master.");
slist.clear();
}

Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmyth/rawsettingseditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ bool RawSettingsEditor::Create(void)

if (!m_settingsList || !m_textLabel || !m_saveButton || !m_cancelButton)
{
VERBOSE(VB_IMPORTANT, "Theme is missing critical theme elements.");
LogPrint(VB_GENERAL, LOG_EMERG,
"Theme is missing critical theme elements.");
return false;
}

Expand Down
55 changes: 25 additions & 30 deletions mythtv/libs/libmyth/remoteutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ bool RemoteDeleteRecording(

if (!result)
{
VERBOSE(VB_IMPORTANT, QString("Failed to delete recording %1:%2")
.arg(chanid).arg(recstartts.toString(Qt::ISODate)));
LogPrint(VB_GENERAL, LOG_ALERT,
QString("Failed to delete recording %1:%2")
.arg(chanid).arg(recstartts.toString(Qt::ISODate)));
}

return result;
Expand Down Expand Up @@ -189,8 +190,8 @@ uint RemoteGetRecordingList(

if (numrecordings * NUMPROGRAMLINES + 1 > (int)strList.size())
{
VERBOSE(VB_IMPORTANT, "RemoteGetRecordingList() "
"list size appears to be incorrect.");
LogPrint(VB_GENERAL, LOG_ERR,
"RemoteGetRecordingList() list size appears to be incorrect.");
return 0;
}

Expand Down Expand Up @@ -286,8 +287,6 @@ QDateTime RemoteGetPreviewLastModified(const ProgramInfo *pginfo)
QDateTime RemoteGetPreviewIfModified(
const ProgramInfo &pginfo, const QString &cachefile)
{
QString loc_err("RemoteGetPreviewIfModified, Error: ");

QDateTime cacheLastModified;
QFileInfo cachefileinfo(cachefile);
if (cachefileinfo.exists())
Expand All @@ -302,20 +301,16 @@ QDateTime RemoteGetPreviewIfModified(
if (!gCoreContext->SendReceiveStringList(strlist) ||
strlist.empty() || strlist[0] == "ERROR")
{
VERBOSE(VB_IMPORTANT, loc_err +
QString("Remote error") +
((strlist.size() >= 2) ?
(QString(":\n\t\t\t") + strlist[1]) : QString("")));
LogPrint(VB_GENERAL, LOG_ERR, "Remote error" +
((strlist.size() >= 2) ? (":\n\t\t\t" + strlist[1]) : ""));

return QDateTime();
}

if (strlist[0] == "WARNING")
{
VERBOSE(VB_NETWORK, QString("RemoteGetPreviewIfModified, Warning: ") +
QString("Remote warning") +
((strlist.size() >= 2) ?
(QString(":\n\t\t\t") + strlist[1]) : QString("")));
LogPrint(VB_NETWORK, LOG_WARNING, "Remote warning" +
((strlist.size() >= 2) ? (":\n\t\t\t" + strlist[1]) : ""));

return QDateTime();
}
Expand All @@ -335,37 +330,36 @@ QDateTime RemoteGetPreviewIfModified(
QByteArray data = QByteArray::fromBase64(strlist[3].toAscii());
if ((size_t) data.size() < length)
{ // (note data.size() may be up to 3 bytes longer after decoding
VERBOSE(VB_IMPORTANT, loc_err +
QString("Preview size check failed %1 < %2")
.arg(data.size()).arg(length));
LogPrint(VB_GENERAL, LOG_ERR,
QString("Preview size check failed %1 < %2")
.arg(data.size()).arg(length));
return QDateTime();
}
data.resize(length);

if (checksum16 != qChecksum(data.constData(), data.size()))
{
VERBOSE(VB_IMPORTANT, loc_err + "Preview checksum failed");
LogPrint(VB_GENERAL, LOG_ERR, "Preview checksum failed");
return QDateTime();
}

QString pdir(cachefile.section("/", 0, -2));
QDir cfd(pdir);
if (!cfd.exists() && !cfd.mkdir(pdir))
{
VERBOSE(VB_IMPORTANT, loc_err +
QString("Unable to create remote cache directory '%1'")
.arg(pdir));
LogPrint(VB_GENERAL, LOG_ERR,
QString("Unable to create remote cache directory '%1'")
.arg(pdir));

return QDateTime();
}

QFile file(cachefile);
if (!file.open(QIODevice::WriteOnly|QIODevice::Truncate))
{
VERBOSE(VB_IMPORTANT, loc_err +
QString("Unable to open cached "
"preview file for writing '%1'")
.arg(cachefile));
LogPrint(VB_GENERAL, LOG_ERR,
QString("Unable to open cached preview file for writing '%1'")
.arg(cachefile));

return QDateTime();
}
Expand All @@ -390,9 +384,9 @@ QDateTime RemoteGetPreviewIfModified(

if (remaining)
{
VERBOSE(VB_IMPORTANT, loc_err +
QString("Failed to write cached preview file '%1'")
.arg(cachefile));
LogPrint(VB_GENERAL, LOG_ERR,
QString("Failed to write cached preview file '%1'")
.arg(cachefile));

file.resize(0); // in case unlink fails..
file.remove(); // closes fd
Expand Down Expand Up @@ -489,8 +483,9 @@ int RemoteGetFreeRecorderCount(void)

if (strlist[0] == "UNKNOWN_COMMAND")
{
VERBOSE(VB_IMPORTANT, "Unknown command GET_FREE_RECORDER_COUNT, "
"upgrade your backend version.");
LogPrint(VB_GENERAL, LOG_EMERG,
"Unknown command GET_FREE_RECORDER_COUNT, upgrade your "
"backend version.");
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/rssparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ ResultItem::resultList Parse::parseRSS(QDomDocument domDoc)
ResultItem::resultList vList;

QString document = domDoc.toString();
VERBOSE(VB_GENERAL|VB_EXTRA, QString("Will Be Parsing: %1").arg(document));
LogPrint(VB_GENERAL, LOG_DEBUG, "Will Be Parsing: " + document);

QDomElement root = domDoc.documentElement();
QDomElement channel = root.firstChildElement("channel");
Expand Down
46 changes: 24 additions & 22 deletions mythtv/libs/libmyth/schemawizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ MythDBBackupStatus SchemaUpgradeWizard::BackupDB(void)
{
if (emptyDB)
{
VERBOSE(VB_GENERAL,
"The database seems to be empty - not attempting a backup");
LogPrint(VB_GENERAL, LOG_INFO,
"The database seems to be empty - not attempting a backup");
return kDB_Backup_Empty_DB;
}

Expand All @@ -104,18 +104,18 @@ int SchemaUpgradeWizard::Compare(void)
// No current schema? Investigate further:
if (DBver.isEmpty() || DBver == "0")
{
VERBOSE(VB_GENERAL, "No current database version?");
LogPrint(VB_GENERAL, LOG_INFO, "No current database version?");

if (DBUtil::IsNewDatabase())
{
VERBOSE(VB_GENERAL, "Database appears to be empty/new!");
LogPrint(VB_GENERAL, LOG_INFO, "Database appears to be empty/new!");
emptyDB = true;
}
}
else
VERBOSE(VB_GENERAL, QString("Current %1 Schema Version (%2): %3")
.arg(m_schemaName).arg(m_schemaSetting)
.arg(DBver));
LogPrint(VB_GENERAL, LOG_INFO,
QString("Current %1 Schema Version (%2): %3")
.arg(m_schemaName).arg(m_schemaSetting).arg(DBver));

#if TESTING
//DBver = "9" + DBver + "-testing";
Expand All @@ -133,7 +133,7 @@ int SchemaUpgradeWizard::CompareAndWait(const int seconds)
QString message = tr("%1 database schema is old. Waiting to see if DB "
"is being upgraded.").arg(m_schemaName);

VERBOSE(VB_IMPORTANT, message);
LogPrint(VB_GENERAL, LOG_CRIT, message);

MSqlQuery query(MSqlQuery::InitCon());
bool backupRunning = false;
Expand All @@ -147,8 +147,8 @@ int SchemaUpgradeWizard::CompareAndWait(const int seconds)

if (IsBackupInProgress())
{
VERBOSE(VB_IMPORTANT,
"Waiting for Database Backup to complete.");
LogPrint(VB_GENERAL, LOG_CRIT,
"Waiting for Database Backup to complete.");
if (!backupRunning)
{
elapsedTimer.restart();
Expand All @@ -159,8 +159,8 @@ int SchemaUpgradeWizard::CompareAndWait(const int seconds)

if (!lockSchema(query))
{
VERBOSE(VB_IMPORTANT,
"Waiting for Database Upgrade to complete.");
LogPrint(VB_GENERAL, LOG_CRIT,
"Waiting for Database Upgrade to complete.");
if (!upgradeRunning)
{
elapsedTimer.restart();
Expand All @@ -177,10 +177,10 @@ int SchemaUpgradeWizard::CompareAndWait(const int seconds)
}

if (versionsBehind)
VERBOSE(VB_IMPORTANT, "Timed out waiting.");
LogPrint(VB_GENERAL, LOG_CRIT, "Timed out waiting.");
else
VERBOSE(VB_IMPORTANT,
"Schema version was upgraded while we were waiting.");
LogPrint(VB_GENERAL, LOG_CRIT,
"Schema version was upgraded while we were waiting.");
}
// else DB is same version, or newer. Either way, we won't upgrade it

Expand Down Expand Up @@ -313,31 +313,33 @@ SchemaUpgradeWizard::PromptForUpgrade(const char *name,

if (!gui && (!isatty(fileno(stdin)) || !isatty(fileno(stdout))))
{
VERBOSE(VB_GENERAL, "Console is non-interactive, can't prompt user...");
LogPrint(VB_GENERAL, LOG_INFO,
"Console is non-interactive, can't prompt user...");

if (m_expertMode)
{
VERBOSE(VB_IMPORTANT, "Using existing schema.");
LogPrint(VB_GENERAL, LOG_CRIT, "Using existing schema.");
return MYTH_SCHEMA_USE_EXISTING;
}

if (!validDBMS)
{
VERBOSE(VB_IMPORTANT, warnOldDBMS);
LogPrint(VB_GENERAL, LOG_CRIT, warnOldDBMS);
return MYTH_SCHEMA_EXIT;
}

if (versionsBehind < 0)
{
VERBOSE(VB_IMPORTANT, QString("Error: MythTV database has newer "
"%1 schema (%2) than expected (%3).")
.arg(name).arg(DBver).arg(m_newSchemaVer));
LogPrint(VB_GENERAL, LOG_CRIT,
QString("Error: MythTV database has newer %1 schema (%2) "
"than expected (%3).")
.arg(name).arg(DBver).arg(m_newSchemaVer));
return MYTH_SCHEMA_ERROR;
}

if (upgradeIfNoUI && validDBMS)
{
VERBOSE(VB_IMPORTANT, "Upgrading.");
LogPrint(VB_GENERAL, LOG_CRIT, "Upgrading.");
return MYTH_SCHEMA_UPGRADE;
}

Expand Down
15 changes: 9 additions & 6 deletions mythtv/libs/libmyth/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ QWidget* Configurable::configWidget(ConfigurationGroup *cg, QWidget* parent,
(void)cg;
(void)parent;
(void)widgetName;
VERBOSE(VB_IMPORTANT, "BUG: Configurable is visible, but has no "
"configWidget");
LogPrint(VB_GENERAL, LOG_ALERT,
"BUG: Configurable is visible, but has no configWidget");
return NULL;
}

Expand Down Expand Up @@ -199,8 +199,9 @@ void SelectSetting::setValue(int which)
{
if ((which >= ((int) values.size())) || (which < 0))
{
VERBOSE(VB_IMPORTANT, QString("SelectSetting::setValue(): "
"invalid index: %1 size: ").arg(which).arg(values.size()));
LogPrint(VB_GENERAL, LOG_ERR,
QString("SelectSetting::setValue(): invalid index: %1 size: ")
.arg(which).arg(values.size()));
}
else
{
Expand Down Expand Up @@ -991,8 +992,10 @@ void AutoIncrementDBSetting::Save(QString table)
setValue(lii);
}
else
VERBOSE(VB_IMPORTANT, "Can't determine the Id of the last insert"
"QSqlQuery.lastInsertId() failed, the workaround failed too!");
LogPrint(VB_GENERAL, LOG_EMERG,
"Can't determine the Id of the last insert "
"QSqlQuery.lastInsertId() failed, the workaround "
"failed too!");
}
// XXX -- HACK END:
}
Expand Down
16 changes: 9 additions & 7 deletions mythtv/libs/libmyth/uilistbtntype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ void UIListTreeType::SetTree(UIListGenericTree *toplevel)
// Not really an error, as UIListTreeType is perfectly capable of drawing an empty list.
//

// VERBOSE(VB_IMPORTANT, "No top-level children?");
#if 0
LogPrint(VB_GENERAL, LOG_DEBUG, "No top-level children?");
#endif
return;
}

Expand All @@ -256,8 +258,8 @@ void UIListTreeType::SetTree(UIListGenericTree *toplevel)

if (!currentlevel)
{
VERBOSE(VB_IMPORTANT, "Something is seriously wrong (currentlevel = "
"NULL)");
LogPrint(VB_GENERAL, LOG_ALERT,
"Something is seriously wrong (currentlevel = NULL)");
return;
}

Expand Down Expand Up @@ -460,7 +462,7 @@ UIListBtnType *UIListTreeType::GetLevel(int levelnum)
{
if ((uint)levelnum > (uint)listLevels.size())
{
VERBOSE(VB_IMPORTANT, LOC_ERR + "OOB GetLevel call");
LogPrint(VB_GENERAL, LOG_ERR, "OOB GetLevel call");
return NULL;
}

Expand Down Expand Up @@ -737,8 +739,8 @@ bool UIListTreeType::tryToSetCurrent(QStringList route)
currentpos = (UIListGenericTree *)next_child;
if (!currentlevel->MoveToNamedPosition(currentpos->getString()))
{
VERBOSE(VB_IMPORTANT, "had problem finding "
"something it knows is there");
LogPrint(VB_GENERAL, LOG_CRIT,
"had problem finding something it knows is there");
keep_going = false;
}
}
Expand Down Expand Up @@ -1418,7 +1420,7 @@ bool UIListBtnType::MoveItemUpDown(UIListBtnTypeItem *item, bool flag)

if (item != m_selItem)
{
VERBOSE(VB_IMPORTANT, LOC_ERR + "Can't move non-selected item");
LogPrint(VB_GENERAL, LOG_ERR, "Can't move non-selected item");
return false;
}

Expand Down
Loading