Controlling Logging
To provide more information about its inner function Ornatrix can log various events which happen inside its code. For example, it can tell you when hair is being generated or when something that wasn't supposed to happen happens. This is useful for finding a source of a problem or just knowing better what Ornatrix is doing under the hood. Whether logging is used and what it outputs can be controlled via MaxScript or an external settings file.
Logging Levels
There are different levels of logging marking the importance of the message which is produced. These are:
- None: Logging is disabled, no messages will be printed
- Error: Unexpected error - a logical error in the code (ASSERT/CHECK) or a fatal environment error (example: a critical file is missing). The app stops execution (if possible, e.g. not being a plugin DLL inside a host), or advises the user to save his work and exit the app.
- Warning: An environment error after which recovery is possible and execution is safe to continue, most likely with some feature failing to work. Example: failed I/O or any OS API call.
- Info: Information which might be of interest to the users, not just to the developers. It's not a problem, execution continues normally. Example: the start or result of a long running operation.
- Verbose: Information for the developers only. Normally this level is disabled when running the release build on the user's machine but can be enabled so that the user can send the log file back to the developers for inspection.
Loggers
There are two locations to which Ornatrix can write log messages:- The MaxScript Listener window
- An external Ornatrix3dsMax.log file located in C:\Users\USERNAME\AppData\Local\Temp directory, or whatever your TEMP environment variable points to
You can control the level of log messages as outlined above which are printed to each of these loggers. For example, you can set only error messages to be written to the listener and nothing to be written to the file.
Setting Log Level
Through MaxScript
Use OxSetLogLevel
command with following syntax to set logging level through MaxScript:
OxSetLogLevel loggerType logLevel
- loggerType: 0 for Script Listener, 1 for File logger
- logLevel: Level of the log messages, starting with 1 in the same order as listed above
For example, to set the maximum logging level and see all messages in MaxScript listener use:
OxSetLogLevel 0 5
Counting Assertions
It may also be useful to know how many internal code assertions happened since the start of the current Max session. This can be used for testing or knowing if something went wrong in your scene. The number of assertions should ideally always be 0. An assertion typically indicates that the scene could be corrupted and that you should save your file and restart 3dsmax.
To get the current number of assertions use the following MaxScript command:
OxGetAssertCount()