@@ -72,25 +72,35 @@ int main(int argc, char** argv) {
72
72
app.allow_windows_style_options (); /* we want Windows-style options */
73
73
app.allow_extras ();
74
74
75
- bool realtime_enabled, debugger_enabled ;
76
- string machine_str ;
75
+ bool realtime_enabled = false ;
76
+ bool debugger_enabled = false ;
77
77
string bootrom_path (" bootrom.bin" );
78
78
79
79
app.add_flag (" -r,--realtime" , realtime_enabled,
80
80
" Run the emulator in real-time" );
81
-
82
81
app.add_flag (" -d,--debugger" , debugger_enabled,
83
82
" Enter the built-in debugger" );
84
-
85
83
app.add_option (" -b,--bootrom" , bootrom_path, " Specifies BootROM path" )
86
84
->check (CLI::ExistingFile);
87
85
86
+ bool log_to_stderr = false ;
87
+ loguru::Verbosity log_verbosity = loguru::Verbosity_INFO;
88
+ bool log_no_uptime = false ;
89
+ app.add_flag (" --log-to-stderr" , log_to_stderr,
90
+ " Send internal logging to stderr (instead of dingusppc.log)" );
91
+ app.add_flag (" --log-verbosity" , log_verbosity,
92
+ " Adjust logging verbosity (default is 0 a.k.a. INFO)" )
93
+ ->check (CLI::Number);
94
+ app.add_flag (" --log-no-uptime" , log_no_uptime,
95
+ " Disable the uptime preamble of logged messages" );
96
+
88
97
uint32_t profiling_interval_ms = 0 ;
89
98
#ifdef CPU_PROFILING
90
99
app.add_option (" --profiling-interval-ms" , profiling_interval_ms,
91
100
" Specifies periodic interval (in ms) at which to output CPU profiling information" );
92
101
#endif
93
102
103
+ string machine_str;
94
104
CLI::Option* machine_opt = app.add_option (" -m,--machine" ,
95
105
machine_str, " Specify machine ID" );
96
106
@@ -118,20 +128,21 @@ int main(int argc, char** argv) {
118
128
if (debugger_enabled) {
119
129
if (realtime_enabled)
120
130
cout << " Both realtime and debugger enabled! Using debugger" << endl;
121
- execution_mode = 1 ;
131
+ execution_mode = debugger ;
122
132
}
123
133
124
134
/* initialize logging */
125
135
loguru::g_preamble_date = false ;
126
136
loguru::g_preamble_time = false ;
127
137
loguru::g_preamble_thread = false ;
138
+ loguru::g_preamble_uptime = !log_no_uptime;
128
139
129
- if (! execution_mode) {
140
+ if (execution_mode == interpreter && !log_to_stderr ) {
130
141
loguru::g_stderr_verbosity = loguru::Verbosity_OFF;
131
142
loguru::init (argc, argv);
132
- loguru::add_file (" dingusppc.log" , loguru::Append, 0 );
143
+ loguru::add_file (" dingusppc.log" , loguru::Append, log_verbosity );
133
144
} else {
134
- loguru::g_stderr_verbosity = loguru::Verbosity_INFO ;
145
+ loguru::g_stderr_verbosity = log_verbosity ;
135
146
loguru::init (argc, argv);
136
147
}
137
148
0 commit comments