logfile Object

logfile is a pre-defined PinballY object that lets you write messages to the program's log file. This can be helpful for debugging purposes, as a quick way to verify that a particular function is being called, an event is occurring, etc. For more on debugging in general, see Javascript debugging.

The log is a text file named PinballY.log, located in the main PinballY program folder. PinballY automatically creates this file each time you run the program, and writes miscellaneous status messages to the file throughout the session. The log file is mostly for troubleshooting purposes; it has details on what the program was attempting to do, such as which directories it scanned for games and media files, what happened when it tried to load various external DLLs or access third-party programs, etc. You can control which types of status messages the system writes to the file via the program's main Options dialog.

Any messages you write from Javascript via the logfile object are included in the file unconditionally. There are no option settings that will disable your scripting messages. (The "Javascript" option in the dialog only controls whether or not Javascript-related messages generated by the system itself are included; it doesn't affect your script-generated messages.)

Methods

logfile.log(object, ...): Converts all of the arguments to string values using normal Javascript rules, and writes the strings to the log file, separated by spaces. A newline is appended at the end of the text.

logfile.log(formatString, ...): If the first argument to logfile.log() is a string, and it contains one or more "printf"-style "%" format codes, logfile.log() interprets it as a format string with substitution variables. Each "%" code is replaced with a formatted version of the corresponding argument from the arguments list, in left-to-right order. This uses the same formatting rules as console.log().