-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log xlua failures messages to the X-Plane log file. #15
base: master
Are you sure you want to change the base?
Conversation
Define NO_LOG_MESSAGE to compile out this change
Thanks for the contribution! Can I ask you to make a couple of changes, please? First, if you look in l_my_print(), there's a standard prefix that's used for the log to give a timestamp and a feature code. That should be added to the start of any other lines directed towards XPLMDebugString(). Second, there are people who will still expect printf output so instead of using an #ifdef to choose one behaviour or the other, just have your new log function also output to console, again as l_my_print() does. If you can merge the two functions - your new log_message and the lua-side l_my_print - so much the better. |
I'll take a look! Do you want me to reverse the #if def to allow the new log messages to be compiled out, or just keep both in? |
I think remove the #ifdefs. If the new log function sends to both the log and console there's no need to be able to separate them at compile time. |
OK, the prefix requires access to the dataref, currently static inside xpfuncs.
|
Option 3 seems cleanest. |
log_message implementation moved to xpfuncs.cpp #if defines for log/print alternative removed now always performs both
Think that's what you asked for! |
Hold off missing braces! |
The Warning if required additional braces now it has two logging lines! |
On Windows, the current xlua messages sent to the stdout of the process come from a process other than the one launched, so redirecting to a file does not capture them. Without them syntax and other errors are far harder to catch!
This change replaces the 'printf's with a function which uses XPLMDebugString to direct the otherwise missing content to the X-Plane logfile.
In addition the traceback function now triggers a log message so again it is visible on Windows.
This change can be compiled out by #defining NO_LOG_MESSAGE