mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* Start tomahawk with --verbose to get full logging and console output, again.
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
@@ -33,10 +34,11 @@
|
|||||||
#define LOGFILE_SIZE 1024 * 512
|
#define LOGFILE_SIZE 1024 * 512
|
||||||
|
|
||||||
#define RELEASE_LEVEL_THRESHOLD 0
|
#define RELEASE_LEVEL_THRESHOLD 0
|
||||||
#define DEBUG_LEVEL_THRESHOLD 5
|
#define DEBUG_LEVEL_THRESHOLD LOGEXTRA
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
ofstream logfile;
|
ofstream logfile;
|
||||||
|
static int s_threshold = -1;
|
||||||
|
|
||||||
namespace Logger
|
namespace Logger
|
||||||
{
|
{
|
||||||
@@ -44,6 +46,18 @@ namespace Logger
|
|||||||
static void
|
static void
|
||||||
log( const char *msg, unsigned int debugLevel, bool toDisk = true )
|
log( const char *msg, unsigned int debugLevel, bool toDisk = true )
|
||||||
{
|
{
|
||||||
|
if ( s_threshold < 0 )
|
||||||
|
{
|
||||||
|
if ( qApp->arguments().contains( "--verbose" ) )
|
||||||
|
s_threshold = LOGTHIRDPARTY;
|
||||||
|
else
|
||||||
|
#ifdef QT_NO_DEBUG
|
||||||
|
s_threshold = RELEASE_LEVEL_THRESHOLD;
|
||||||
|
#else
|
||||||
|
s_threshold = DEBUG_LEVEL_THRESHOLD;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef QT_NO_DEBUG
|
#ifdef QT_NO_DEBUG
|
||||||
if ( debugLevel > RELEASE_LEVEL_THRESHOLD )
|
if ( debugLevel > RELEASE_LEVEL_THRESHOLD )
|
||||||
toDisk = false;
|
toDisk = false;
|
||||||
@@ -52,15 +66,18 @@ log( const char *msg, unsigned int debugLevel, bool toDisk = true )
|
|||||||
toDisk = false;
|
toDisk = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( toDisk )
|
if ( toDisk || (int)debugLevel <= s_threshold )
|
||||||
{
|
{
|
||||||
logfile << QTime::currentTime().toString().toAscii().data() << " [" << QString::number( debugLevel ).toAscii().data() << "]: " << msg << endl;
|
logfile << QTime::currentTime().toString().toAscii().data() << " [" << QString::number( debugLevel ).toAscii().data() << "]: " << msg << endl;
|
||||||
logfile.flush();
|
logfile.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( debugLevel <= LOGVERBOSE || (int)debugLevel <= s_threshold )
|
||||||
|
{
|
||||||
cout << msg << endl;
|
cout << msg << endl;
|
||||||
cout.flush();
|
cout.flush();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user