Skip to content

Commit

Permalink
Reduce some LOG_CRIT log level messages to LOG_NOTICE or LOG_ERR as a…
Browse files Browse the repository at this point in the history
…ppropriate.

This is mostly not my code so my judgement calls may be off in some cases, but the general concept is that LOG_NOTICE is for informational/state messages of greater importantce than average (LOG_INFO), while LOG_ERR is for normal errors and LOG_CRIT is for extreemely critical information; like an error that indicates you should replace your hardware.
  • Loading branch information
daniel-kristjansson committed Aug 1, 2011
1 parent 2334dd1 commit acb9402
Show file tree
Hide file tree
Showing 20 changed files with 64 additions and 62 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/netgrabbermanager.cpp
Expand Up @@ -55,7 +55,7 @@ void GrabberScript::run()
uint status = getTree.Wait();

if( status == GENERIC_EXIT_CMD_NOT_FOUND )
LOG(VB_GENERAL, LOG_CRIT, LOC +
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Internet Content Source %1 cannot run, file missing.")
.arg(m_title));
else if( status == GENERIC_EXIT_OK )
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/uilistbtntype.cpp
Expand Up @@ -737,7 +737,7 @@ bool UIListTreeType::tryToSetCurrent(QStringList route)
currentpos = (UIListGenericTree *)next_child;
if (!currentlevel->MoveToNamedPosition(currentpos->getString()))
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
"had problem finding something it knows is there");
keep_going = false;
}
Expand Down
10 changes: 5 additions & 5 deletions mythtv/libs/libmyth/uitypes.cpp
Expand Up @@ -767,7 +767,7 @@ void UIImageType::LoadImage()

if (!GetMythUI()->FindThemeFile(file))
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
"UIImageType::LoadImage() - Cannot find image: " + m_filename);
m_show = false;
return;
Expand Down Expand Up @@ -1017,7 +1017,7 @@ void UIRepeatedImageType::setOrientation(int x)
{
if (x < 0 || x > 3)
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
QString("UIRepeatedImageType received an invalid "
"request to set orientation to %1") .arg(x));
return;
Expand Down Expand Up @@ -1603,7 +1603,7 @@ QPixmap *UIImageGridType::createScaledPixmap(QString filename,
QImage *img = GetMythUI()->LoadScaleImage(filename);
if (!img)
{
LOG(VB_GENERAL, LOG_CRIT, "Failed to load image" + filename);
LOG(VB_GENERAL, LOG_ERR, "Failed to load image" + filename);
return NULL;
}
else
Expand Down Expand Up @@ -2196,7 +2196,7 @@ void UIManagedTreeListType::Draw(QPainter *p, int drawlayer, int context)
GenericTree *parent = current_node->getParent();
if (parent == NULL)
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
"LCD sees no parent to current_node" );
}
else
Expand Down Expand Up @@ -4321,7 +4321,7 @@ QString UIKeyType::decodeChar(QString c)
res += QString(uc);
}
else
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
QString("UIKeyType::decodeChar - bad char code (%1)")
.arg(sCode));
}
Expand Down
12 changes: 6 additions & 6 deletions mythtv/libs/libmythbase/httpcomms.cpp
Expand Up @@ -358,7 +358,7 @@ QString HttpComms::getHttp(QString &url,
// Increment the counter and check we're not over the limit
if (redirectCount++ >= maxRedirects)
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
QString("Maximum redirections reached for url: %1")
.arg(url));
break;
Expand Down Expand Up @@ -428,7 +428,7 @@ bool HttpComms::getHttpFile(const QString& filename, QString& url, int timeoutMS
int statusCode = httpGrabber->getStatusCode();
if (statusCode < 200 || statusCode > 401)
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
QString("Server returned an error status code %1 for url: %2")
.arg(statusCode)
.arg(url));
Expand All @@ -444,7 +444,7 @@ bool HttpComms::getHttpFile(const QString& filename, QString& url, int timeoutMS
// Increment the counter and check we're not over the limit
if (timeoutCount++ >= maxRetries)
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
QString("Failed to contact server for url: '%1'")
.arg(url));
break;
Expand All @@ -471,7 +471,7 @@ bool HttpComms::getHttpFile(const QString& filename, QString& url, int timeoutMS
// Increment the counter and check we're not over the limit
if (redirectCount++ >= maxRedirects)
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
QString("Maximum redirections reached for url: %1")
.arg(url));
break;
Expand Down Expand Up @@ -603,7 +603,7 @@ QString HttpComms::postHttp(
// Increment the counter and check we're not over the limit
if (timeoutCount++ >= maxRetries)
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
QString("Failed to contact server for url: %1")
.arg(url.toString()));
break;
Expand All @@ -630,7 +630,7 @@ QString HttpComms::postHttp(
// Increment the counter and check we're not over the limit
if (redirectCount++ >= maxRedirects)
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
QString("Maximum redirections reached for url: %1")
.arg(url.toString()));
break;
Expand Down
9 changes: 5 additions & 4 deletions mythtv/libs/libmythbase/lcddevice.cpp
Expand Up @@ -144,11 +144,11 @@ bool LCD::connectToHost(const QString &lhostname, unsigned int lport)
if (myth_system("ps ch -C mythlcdserver -o pid > /dev/null", flags) == 1)
{
// we need to start the mythlcdserver
LOG(VB_GENERAL, LOG_CRIT, "Starting mythlcdserver");
LOG(VB_GENERAL, LOG_NOTICE, "Starting mythlcdserver");

if (!startLCDServer())
{
LOG(VB_GENERAL, LOG_CRIT, "Failed start MythTV LCD Server");
LOG(VB_GENERAL, LOG_ERR, "Failed start MythTV LCD Server");
return bConnected;
}

Expand Down Expand Up @@ -214,8 +214,9 @@ void LCD::sendToServer(const QString &someText)
// connection
retryTimer->setSingleShot(false);
retryTimer->start(10000);
LOG(VB_GENERAL, LOG_CRIT, "Connection to LCDServer died unexpectedly. "
"Trying to reconnect every 10 seconds...");
LOG(VB_GENERAL, LOG_ERR,
"Connection to LCDServer died unexpectedly. "
"Trying to reconnect every 10 seconds...");

bConnected = false;
return;
Expand Down
12 changes: 6 additions & 6 deletions mythtv/libs/libmythbase/logging.cpp
Expand Up @@ -627,8 +627,8 @@ LoggerThread::LoggerThread() :
char *debug = getenv("VERBOSE_THREADS");
if (debug != NULL)
{
LOG(VB_GENERAL, LOG_CRIT, "Logging thread registration/deregistration "
"enabled!");
LOG(VB_GENERAL, LOG_NOTICE,
"Logging thread registration/deregistration enabled!");
debugRegistration = true;
}
}
Expand Down Expand Up @@ -928,7 +928,7 @@ void logStart(QString logfile, int progress, int quiet, int facility,
return;

logLevel = level;
LOG(VB_GENERAL, LOG_CRIT, QString("Setting Log Level to LOG_%1")
LOG(VB_GENERAL, LOG_NOTICE, QString("Setting Log Level to LOG_%1")
.arg(logLevelGetName(logLevel).toUpper()));

logPropagateOpts.propagate = propagate;
Expand Down Expand Up @@ -968,7 +968,7 @@ void logStart(QString logfile, int progress, int quiet, int facility,

#ifndef _WIN32
/* Setup SIGHUP */
LOG(VB_GENERAL, LOG_CRIT, "Setting up SIGHUP handler");
LOG(VB_GENERAL, LOG_NOTICE, "Setting up SIGHUP handler");
struct sigaction sa;
sa.sa_sigaction = logSighup;
sigemptyset( &sa.sa_mask );
Expand Down Expand Up @@ -1059,8 +1059,8 @@ void threadDeregister(void)
int syslogGetFacility(QString facility)
{
#ifdef _WIN32
LOG(VB_GENERAL, LOG_CRIT, "Windows does not support syslog,"
" disabling" );
LOG(VB_GENERAL, LOG_NOTICE,
"Windows does not support syslog, disabling" );
return( -2 );
#else
CODE *name;
Expand Down
10 changes: 5 additions & 5 deletions mythtv/libs/libmythbase/mythcdrom-linux.cpp
Expand Up @@ -167,7 +167,7 @@ int MythCDROMLinux::driveStatus()

if (drive_status == -1) // Very unlikely, but we should check
{
LOG(VB_MEDIA, LOG_INFO, LOC + ":driveStatus() - ioctl failed: " + ENO);
LOG(VB_MEDIA, LOG_ERR, LOC + ":driveStatus() - ioctl failed: " + ENO);
return CDS_NO_INFO;
}

Expand Down Expand Up @@ -406,8 +406,8 @@ MythMediaStatus MythCDROMLinux::checkMedia()
m_MediaType = MEDIATYPE_UNKNOWN;
return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
default:
LOG(VB_GENERAL, LOG_CRIT, "Failed to get drive status of " +
m_DevicePath + " : " + ENO);
LOG(VB_GENERAL, LOG_ERR, "Failed to get drive status of " +
m_DevicePath + " : " + ENO);
m_MediaType = MEDIATYPE_UNKNOWN;
return setStatus(MEDIASTAT_UNKNOWN, OpenedHere);
}
Expand Down Expand Up @@ -628,7 +628,7 @@ bool MythCDROMLinux::isSameDevice(const QString &path)

if (stat(path.toLocal8Bit().constData(), &sb) < 0)
{
LOG(VB_GENERAL, LOG_CRIT, LOC + ":isSameDevice() -- " +
LOG(VB_GENERAL, LOG_ERR, LOC + ":isSameDevice() -- " +
QString("Failed to stat '%1'").arg(path) + ENO);
return false;
}
Expand All @@ -637,7 +637,7 @@ bool MythCDROMLinux::isSameDevice(const QString &path)
// Check against m_DevicePath...
if (stat(m_DevicePath.toLocal8Bit().constData(), &sb) < 0)
{
LOG(VB_GENERAL, LOG_CRIT, LOC + ":isSameDevice() -- " +
LOG(VB_GENERAL, LOG_ERR, LOC + ":isSameDevice() -- " +
QString("Failed to stat '%1'").arg(m_DevicePath) + ENO);
return false;
}
Expand Down
11 changes: 6 additions & 5 deletions mythtv/libs/libmythbase/mythcommandlineparser.cpp
Expand Up @@ -1106,11 +1106,12 @@ int MythCommandLineParser::ConfigureLogging(QString mask, unsigned int progress)
if (level == LOG_UNKNOWN)
return GENERIC_EXIT_INVALID_CMDLINE;

LOG(VB_GENERAL, LOG_CRIT, QString("%1 version: %2 [%3] www.mythtv.org")
.arg(QCoreApplication::applicationName())
.arg(MYTH_SOURCE_PATH) .arg(MYTH_SOURCE_VERSION));
LOG(VB_GENERAL, LOG_CRIT, QString("Enabled verbose msgs: %1")
.arg(verboseString));
LOG(VB_GENERAL, LOG_CRIT,
QString("%1 version: %2 [%3] www.mythtv.org")
.arg(QCoreApplication::applicationName())
.arg(MYTH_SOURCE_PATH).arg(MYTH_SOURCE_VERSION));
LOG(VB_GENERAL, LOG_NOTICE,
QString("Enabled verbose msgs: %1").arg(verboseString));

QString logfile = GetLogFilePath();
bool propagate = toBool("islogpath");
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythbase/mythcorecontext.cpp
Expand Up @@ -823,7 +823,7 @@ bool MythCoreContext::SendReceiveStringList(QStringList &strlist,

if (!ok)
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_NOTICE,
QString("Connection to backend server lost"));
d->m_serverSock->DownRef();
d->m_serverSock = NULL;
Expand Down Expand Up @@ -938,8 +938,8 @@ void MythCoreContext::connectionClosed(MythSocket *sock)
{
(void)sock;

LOG(VB_GENERAL, LOG_CRIT, "Event socket closed. No connection to the "
"backend.");
LOG(VB_GENERAL, LOG_NOTICE,
"Event socket closed. No connection to the backend.");

QMutexLocker locker(&d->m_sockLock);
if (d->m_serverSock)
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythbase/mythcoreutil.cpp
Expand Up @@ -75,7 +75,7 @@ bool extractZIP(const QString &zipFile, const QString &outDir)

if (ec != UnZip::Ok)
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
QString("extractZIP(): Unable to open ZIP file %1")
.arg(zipFile));
return false;
Expand All @@ -85,7 +85,7 @@ bool extractZIP(const QString &zipFile, const QString &outDir)

if (ec != UnZip::Ok)
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
QString("extractZIP(): Error extracting ZIP file %1")
.arg(zipFile));
return false;
Expand All @@ -109,8 +109,8 @@ static QString downloadRemoteFile(const QString &cmd, const QString &url,

if (!ok || strlist.size() < 2 || strlist[0] != "OK")
{
LOG(VB_GENERAL, LOG_CRIT, "downloadRemoteFile(): " + cmd +
" returned ERROR!");
LOG(VB_GENERAL, LOG_ERR,
"downloadRemoteFile(): " + cmd + " returned ERROR!");
return QString();
}

Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythbase/mythdirs.cpp
Expand Up @@ -48,20 +48,20 @@ void InitializeMythDirs(void)
installprefix = prefixDir.canonicalPath();
}

LOG(VB_GENERAL, LOG_CRIT, "Using runtime prefix = " + installprefix);
LOG(VB_GENERAL, LOG_NOTICE, "Using runtime prefix = " + installprefix);

char *tmp_confdir = std::getenv("MYTHCONFDIR");
if (tmp_confdir)
{
confdir = QString(tmp_confdir);
LOG(VB_GENERAL, LOG_CRIT, QString("Read conf dir = %1").arg(confdir));
LOG(VB_GENERAL, LOG_NOTICE, QString("Read conf dir = %1").arg(confdir));
confdir.replace("$HOME", QDir::homePath());
}
else
confdir = QDir::homePath() + "/.mythtv";

LOG(VB_GENERAL, LOG_CRIT, QString("Using configuration directory = %1")
.arg(confdir));
LOG(VB_GENERAL, LOG_NOTICE,
QString("Using configuration directory = %1").arg(confdir));

sharedir = installprefix + "/share/mythtv/";
libdir = installprefix + '/' + QString(LIBDIRNAME) + "/mythtv/";
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythsocket.cpp
Expand Up @@ -845,7 +845,7 @@ bool MythSocket::Validate(uint timeout_ms, bool error_dialog_desired)
}
else if (strlist[0] == "ACCEPT")
{
LOG(VB_GENERAL, LOG_CRIT, QString("Using protocol version %1")
LOG(VB_GENERAL, LOG_NOTICE, QString("Using protocol version %1")
.arg(MYTH_PROTO_VERSION));
setValidated();
return true;
Expand Down
14 changes: 7 additions & 7 deletions mythtv/libs/libmythbase/util.cpp
Expand Up @@ -489,7 +489,7 @@ static void print_timezone_info(QString master_zone_id, QString local_zone_id,
int master_utc_offset, int local_utc_offset,
QString master_time, QString local_time)
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_NOTICE,
QString("Detected time zone settings:\n"
" Master: Zone ID: '%1', UTC Offset: '%2', Current Time: '%3'\n"
" Local: Zone ID: '%4', UTC Offset: '%5', Current Time: '%6'\n")
Expand Down Expand Up @@ -671,7 +671,7 @@ bool getUptime(time_t &uptime)
uptime = ::GetTickCount() / 1000;
#else
// Hmmm. Not Linux, not FreeBSD or Darwin. What else is there :-)
LOG(VB_GENERAL, LOG_CRIT, "Unknown platform. How do I get the uptime?");
LOG(VB_GENERAL, LOG_NOTICE, "Unknown platform. How do I get the uptime?");
return false;
#endif

Expand All @@ -691,7 +691,7 @@ bool getMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM)
struct sysinfo sinfo;
if (sysinfo(&sinfo) == -1)
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
"getMemStats(): Error, sysinfo() call failed.");
return false;
}
Expand All @@ -717,8 +717,8 @@ bool getMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM)
if (host_statistics(mp, HOST_VM_INFO,
(host_info_t)&s, &count) != KERN_SUCCESS)
{
LOG(VB_GENERAL, LOG_CRIT, "getMemStats(): Error, "
"failed to get virtual memory statistics.");
LOG(VB_GENERAL, LOG_ERR, "getMemStats(): Error, "
"failed to get virtual memory statistics.");
return false;
}

Expand All @@ -737,8 +737,8 @@ bool getMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM)
freeVM = (int)(free/1024LL);

#else
LOG(VB_GENERAL, LOG_CRIT, "getMemStats(): Unknown platform. "
"How do I get the memory stats?");
LOG(VB_GENERAL, LOG_NOTICE, "getMemStats(): Unknown platform. "
"How do I get the memory stats?");
return false;
#endif

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/NuppelVideoRecorder.cpp
Expand Up @@ -1222,7 +1222,7 @@ void NuppelVideoRecorder::DoV4L1(void)

if (vm.frames < 2)
{
LOG(VB_GENERAL, LOG_CRIT, LOC + "need a minimum of 2 capture buffers");
LOG(VB_GENERAL, LOG_ERR, LOC + "need a minimum of 2 capture buffers");
KillChildren();
errored = true;
return;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/dtvconfparserhelpers.cpp
Expand Up @@ -29,7 +29,7 @@ QString DTVParamHelper::toString(const char *strings[], int index,
{
if ((index < 0) || ((uint)index >= strings_size))
{
LOG(VB_GENERAL, LOG_CRIT,
LOG(VB_GENERAL, LOG_ERR,
"DTVParamHelper::toString() index out of bounds");

return QString::null;
Expand Down

0 comments on commit acb9402

Please sign in to comment.