@@ -945,6 +945,21 @@ int main(int argc, char *argv[]) {
945
945
sigaddset (&sigset, SIGCHLD);
946
946
sigprocmask (SIG_BLOCK, &sigset, NULL );
947
947
948
+ // Set up DNB logging by default. If the user passes different log flags or a
949
+ // log file, these settings will be modified after processing the command line
950
+ // arguments.
951
+ auto log_callback = OsLogger::GetLogFunction ();
952
+ if (log_callback) {
953
+ // if os_log() support is available, log through that.
954
+ DNBLogSetLogCallback (log_callback, nullptr );
955
+ DNBLog (" debugserver will use os_log for internal logging." );
956
+ } else {
957
+ // Fall back to ASL support.
958
+ DNBLogSetLogCallback (ASLLogCallback, nullptr );
959
+ DNBLog (" debugserver will use ASL for internal logging." );
960
+ }
961
+ DNBLogSetLogMask (/* log_flags*/ 0 );
962
+
948
963
g_remoteSP = std::make_shared<RNBRemote>();
949
964
950
965
RNBRemote *remote = g_remoteSP.get ();
@@ -1318,27 +1333,13 @@ int main(int argc, char *argv[]) {
1318
1333
// It is ok for us to set NULL as the logfile (this will disable any logging)
1319
1334
1320
1335
if (log_file != NULL ) {
1336
+ DNBLog (" debugserver is switching to logging to a file." );
1321
1337
DNBLogSetLogCallback (FileLogCallback, log_file);
1322
1338
// If our log file was set, yet we have no log flags, log everything!
1323
1339
if (log_flags == 0 )
1324
1340
log_flags = LOG_ALL | LOG_RNB_ALL;
1325
-
1326
- DNBLogSetLogMask (log_flags);
1327
- } else {
1328
- // Enable DNB logging
1329
-
1330
- // if os_log() support is available, log through that.
1331
- auto log_callback = OsLogger::GetLogFunction ();
1332
- if (log_callback) {
1333
- DNBLogSetLogCallback (log_callback, nullptr );
1334
- DNBLog (" debugserver will use os_log for internal logging." );
1335
- } else {
1336
- // Fall back to ASL support.
1337
- DNBLogSetLogCallback (ASLLogCallback, NULL );
1338
- DNBLog (" debugserver will use ASL for internal logging." );
1339
- }
1340
- DNBLogSetLogMask (log_flags);
1341
1341
}
1342
+ DNBLogSetLogMask (log_flags);
1342
1343
1343
1344
if (DNBLogEnabled ()) {
1344
1345
for (i = 0 ; i < argc; i++)
0 commit comments