Replace printf with SDL_Log variants
All usages of printf were migrated to SDL_Log functions. This allows the log verbosity to be controlled centrally and the -v flag is only used once for setting the global priority threshold.
Error messages printed before exit were upgraded to the critical log priority. This automatically makes them print out on STDERR without setting the global priority threshold to error (critical is the default threshold in all categories except for the application category where info is the default threshold).
Error messages other than the last before calling exit were kept at the error log priority. This way only a single critical message is printed before exiting and further details show up when running with -v.
Closes: #107 (closed)
Example of log messages with these changes applied:
$ ./bin/osk-sdl -t
CRITICAL: No valid config file specified, use -c [path]
$ ./bin/osk-sdl -t -v
ERROR: Could not open config file: /etc/osk.conf
CRITICAL: No valid config file specified, use -c [path]
This turned out to be a little more subtle than just string-replacing the printf
calls. I wasn't always sure what the best log category would be. Curious what others think of my choices.
Merge request reports
Activity
added 1 commit
- d9773ba9 - Replace printf with SDL_Log variants
By Johannes Marbach on 2020-12-05T19:58:57
- Resolved by Administrator
- Resolved by Administrator
- Resolved by Administrator
added 1 commit
- eba8f133 - Replace printf with SDL_Log variants
By Johannes Marbach on 2020-12-07T18:38:43
added 1 commit
- 6e15cf38 - Replace printf with SDL_Log variants
By Johannes Marbach on 2020-12-07T18:43:03
added 1 commit
- 945a69eb - Replace printf with SDL_Log variants
By Johannes Marbach on 2020-12-07T18:48:31
added 1 commit
- 7941343c - Replace printf with SDL_Log variants (MR 108)
By clayton craft on 2020-12-08T00:40:50
mentioned in merge request !105 (merged)
By clayton craft on 2020-12-08T00:49:52
mentioned in merge request !104 (merged)
By Johannes Marbach on 2020-12-12T09:25:28