Skip to content

Commit

Permalink
Turned off log to file in SPIERSedit and SPIERSview
Browse files Browse the repository at this point in the history
  • Loading branch information
alanspencer committed Jun 1, 2020
1 parent 5e0c9c4 commit 5e48e22
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
15 changes: 10 additions & 5 deletions SPIERSedit/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void logMessageOutput(QtMsgType type, const QMessageLogContext &context, const Q
{
QByteArray localMsg = msg.toLocal8Bit();
QString txt;
bool logToFile = true;
bool logToFile = false;

switch (type)
{
Expand All @@ -62,7 +62,8 @@ void logMessageOutput(QtMsgType type, const QMessageLogContext &context, const Q
txt = QString("Info: %1 (%2:%3, %4)").arg(localMsg.constData()).arg(context.file).arg(context.line).arg(context.function);
break;
}
if (logToFile) {
if (logToFile)
{
// Save to debug.log
QString path = QString("%1/SPIERSEdit_debug.log").arg(QDir::homePath());
QFile outFile(path);
Expand All @@ -73,7 +74,9 @@ void logMessageOutput(QtMsgType type, const QMessageLogContext &context, const Q
// Now print to stout too
QTextStream console(stdout);
console << txt << endl;
} else {
}
else
{
// Print to stout only
QTextStream console(stdout);
console << txt << endl;
Expand Down Expand Up @@ -141,7 +144,8 @@ main::main(int &argc, char *argv[]) : QApplication(argc, argv)
bool main::event(QEvent *event)
{
//we don't do anything if we were passed and argv1 - i.e. if we are a child process of first one
if (donthandlefileevent == true) {
if (donthandlefileevent == true)
{
qDebug() << "Don't handle file open event";
return QApplication::event(event);
}
Expand Down Expand Up @@ -176,7 +180,8 @@ int main(int argc, char *argv[])
// Install the message handler to log to file
qInstallMessageHandler(logMessageOutput);

if (argc == 2) {
if (argc == 2)
{
qDebug() << "argc == 2";
// Check that the passed file name has at least 2 characters
if (QString(argv[1]).length() < 2)
Expand Down
15 changes: 10 additions & 5 deletions SPIERSview/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void logMessageOutput(QtMsgType type, const QMessageLogContext &context, const Q
{
QByteArray localMsg = msg.toLocal8Bit();
QString txt;
bool logToFile = true;
bool logToFile = false;

switch (type)
{
Expand All @@ -53,7 +53,8 @@ void logMessageOutput(QtMsgType type, const QMessageLogContext &context, const Q
txt = QString("Info: %1 (%2:%3, %4)").arg(localMsg.constData()).arg(context.file).arg(context.line).arg(context.function);
break;
}
if (logToFile) {
if (logToFile)
{
// Save to debug.log
QString path = QString("%1/SPIERSView_debug.log").arg(QDir::homePath());
QFile outFile(path);
Expand All @@ -64,7 +65,9 @@ void logMessageOutput(QtMsgType type, const QMessageLogContext &context, const Q
// Now print to stout too
QTextStream console(stdout);
console << txt << endl;
} else {
}
else
{
// Print to stout only
QTextStream console(stdout);
console << txt << endl;
Expand Down Expand Up @@ -183,7 +186,8 @@ main::main(int &argc, char *argv[]) : QApplication(argc, argv)
bool main::event(QEvent *event)
{
//we don't do anything if we were passed and argv1 - i.e. if we are a child process of first one
if (donthandlefileevent == true) {
if (donthandlefileevent == true)
{
qDebug() << "Don't handle file open event";
return QApplication::event(event);
}
Expand Down Expand Up @@ -241,7 +245,8 @@ int main(int argc, char *argv[])
// Install the message handler to log to file
qInstallMessageHandler(logMessageOutput);

if (argc == 2) {
if (argc == 2)
{
qDebug() << "argc == 2";
// Check that the passed file name has at least 2 characters
if (QString(argv[1]).length() < 2)
Expand Down

0 comments on commit 5e48e22

Please sign in to comment.