Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
b974dff7
Commit
b974dff7
authored
Jun 08, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new --full-logging option
parent
0fd87cd8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
41 deletions
+45
-41
QGCApplication.cc
src/QGCApplication.cc
+45
-41
No files found.
src/QGCApplication.cc
View file @
b974dff7
...
...
@@ -147,46 +147,61 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
#ifndef __android__
setAttribute
(
Qt
::
AA_DontCreateNativeWidgetSiblings
);
#endif
// Parse command line options
bool
fClearSettingsOptions
=
false
;
// Clear stored settings
bool
fullLogging
=
false
;
// Turn on all logging
CmdLineOpt_t
rgCmdLineOptions
[]
=
{
{
"--clear-settings"
,
&
fClearSettingsOptions
,
QString
()
},
{
"--full-logging"
,
&
fullLogging
,
QString
()
},
// Add additional command line option flags here
};
ParseCmdLineOptions
(
argc
,
argv
,
rgCmdLineOptions
,
sizeof
(
rgCmdLineOptions
)
/
sizeof
(
rgCmdLineOptions
[
0
]),
false
);
#ifdef __mobile__
QLoggingCategory
::
setFilterRules
(
QStringLiteral
(
"*Log.debug=false"
));
#endif
#ifndef __mobile__
// First thing we want to do is set up the qtlogging.ini file. If it doesn't already exist we copy
// it to the correct location. This way default debug builds will have logging turned off.
#else
if
(
fullLogging
)
{
QLoggingCategory
::
setFilterRules
(
QStringLiteral
(
"*Log=true"
));
}
else
{
// First thing we want to do is set up the qtlogging.ini file. If it doesn't already exist we copy
// it to the correct location. This way default debug builds will have logging turned off.
static
const
char
*
qtProjectDir
=
"QtProject"
;
static
const
char
*
qtLoggingFile
=
"qtlogging.ini"
;
bool
loggingDirectoryOk
=
false
;
static
const
char
*
qtProjectDir
=
"QtProject"
;
static
const
char
*
qtLoggingFile
=
"qtlogging.ini"
;
bool
loggingDirectoryOk
=
false
;
QDir
iniFileLocation
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericConfigLocation
));
if
(
!
iniFileLocation
.
cd
(
qtProjectDir
))
{
if
(
!
iniFileLocation
.
mkdir
(
qtProjectDir
))
{
qDebug
()
<<
"Unable to create qtlogging.ini directory"
<<
iniFileLocation
.
filePath
(
qtProjectDir
);
}
else
{
if
(
!
iniFileLocation
.
cd
(
qtProjectDir
))
{
qDebug
()
<<
"Unable to access qtlogging.ini directory"
<<
iniFileLocation
.
filePath
(
qtProjectDir
);;
QDir
iniFileLocation
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericConfigLocation
));
if
(
!
iniFileLocation
.
cd
(
qtProjectDir
))
{
if
(
!
iniFileLocation
.
mkdir
(
qtProjectDir
))
{
qDebug
()
<<
"Unable to create qtlogging.ini directory"
<<
iniFileLocation
.
filePath
(
qtProjectDir
);
}
else
{
if
(
!
iniFileLocation
.
cd
(
qtProjectDir
))
{
qDebug
()
<<
"Unable to access qtlogging.ini directory"
<<
iniFileLocation
.
filePath
(
qtProjectDir
);;
}
loggingDirectoryOk
=
true
;
}
}
else
{
loggingDirectoryOk
=
true
;
}
}
else
{
loggingDirectoryOk
=
true
;
}
if
(
loggingDirectoryOk
)
{
qDebug
()
<<
iniFileLocation
;
if
(
!
iniFileLocation
.
exists
(
qtLoggingFile
))
{
QFile
loggingFile
(
iniFileLocation
.
filePath
(
qtLoggingFile
));
if
(
loggingFile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
{
QTextStream
out
(
&
loggingFile
);
out
<<
"[Rules]
\n
"
;
out
<<
"*Log.debug=false
\n
"
;
foreach
(
QString
category
,
QGCLoggingCategoryRegister
::
instance
()
->
registeredCategories
())
{
out
<<
category
<<
".debug=false
\n
"
;
if
(
loggingDirectoryOk
)
{
qDebug
()
<<
iniFileLocation
;
if
(
!
iniFileLocation
.
exists
(
qtLoggingFile
))
{
QFile
loggingFile
(
iniFileLocation
.
filePath
(
qtLoggingFile
));
if
(
loggingFile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
{
QTextStream
out
(
&
loggingFile
);
out
<<
"[Rules]
\n
"
;
out
<<
"*Log.debug=false
\n
"
;
foreach
(
QString
category
,
QGCLoggingCategoryRegister
::
instance
()
->
registeredCategories
())
{
out
<<
category
<<
".debug=false
\n
"
;
}
}
else
{
qDebug
()
<<
"Unable to create logging file"
<<
QString
(
qtLoggingFile
)
<<
"in"
<<
iniFileLocation
;
}
}
else
{
qDebug
()
<<
"Unable to create logging file"
<<
QString
(
qtLoggingFile
)
<<
"in"
<<
iniFileLocation
;
}
}
}
...
...
@@ -217,17 +232,6 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
// Set settings format
QSettings
::
setDefaultFormat
(
QSettings
::
IniFormat
);
// Parse command line options
bool
fClearSettingsOptions
=
false
;
// Clear stored settings
CmdLineOpt_t
rgCmdLineOptions
[]
=
{
{
"--clear-settings"
,
&
fClearSettingsOptions
,
QString
()
},
// Add additional command line option flags here
};
ParseCmdLineOptions
(
argc
,
argv
,
rgCmdLineOptions
,
sizeof
(
rgCmdLineOptions
)
/
sizeof
(
rgCmdLineOptions
[
0
]),
false
);
QSettings
settings
;
#ifdef UNITTEST_BUILD
qDebug
()
<<
"Settings location"
<<
settings
.
fileName
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment